Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(IBAction)handlePan : (UIPanGestureRecognizer *) recognizer
- { CGPoint translation = [recognizer translationInView:self.view];
- recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
- recognizer.view.center.y + translation.y);
- [recognizer setTranslation:CGPointMake(0,0) inView:self.view];
- [self checkCollison];
- }
- -(void) checkCollison
- {
- if (CGRectIntersectsRect(Dot.frame, CollisionImage.frame))
- {
- AudioServicesPlaySystemSound(playSoundId);
- }
- }
- - (void)viewDidLoad
- {
- NSURL *SoundURL = [ NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"beep"ofType:@"wav"]];
- AudioServicesCreateSystemSoundID((__bridge CFURLRef)SoundURL, & playSoundId);
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement