Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. -(IBAction)handlePan : (UIPanGestureRecognizer *) recognizer
  2.  
  3. { CGPoint translation = [recognizer translationInView:self.view];
  4. recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
  5. recognizer.view.center.y + translation.y);
  6. [recognizer setTranslation:CGPointMake(0,0) inView:self.view];
  7.  
  8. [self checkCollison];
  9.  
  10. }
  11.  
  12. -(void) checkCollison
  13. {
  14.  
  15. if (CGRectIntersectsRect(Dot.frame, CollisionImage.frame))
  16.  
  17. {
  18.  
  19. AudioServicesPlaySystemSound(playSoundId);
  20. }
  21.  
  22.  
  23. }
  24.  
  25. - (void)viewDidLoad
  26. {
  27.  
  28. NSURL *SoundURL = [ NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"beep"ofType:@"wav"]];
  29. AudioServicesCreateSystemSoundID((__bridge CFURLRef)SoundURL, & playSoundId);
  30.  
  31. [super viewDidLoad];
  32. // Do any additional setup after loading the view.
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement