Guest User

Untitled

a guest
Jul 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // HelloWorld Layer
  2. @interface
  3. HelloWorld : CCLayer {
  4. cpSpace *space;
  5. CCSprite *ball;
  6. }
  7.  
  8. - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
  9. {
  10. for( UITouch *touch in touches ) {
  11. CGPoint location = [touch locationInView: [touch view]];
  12.  
  13. location = [[CCDirector sharedDirector] convertToGL: location];
  14.  
  15. // Determine speed of the target
  16. int minDuration = 2.0;
  17. int maxDuration = 4.0;
  18. int rangeDuration = maxDuration - minDuration;
  19. int actualDuration = (arc4random() % rangeDuration) + minDuration;
  20.  
  21. // Create the actions
  22. id actionMove = [CCMoveTo actionWithDuration:actualDuration
  23. position:ccp(location.x, location.y)];
  24. id actionMoveDone = [CCCallFuncN actionWithTarget:self
  25. selector:@selector(spriteMoveFinished:)];
  26. [ball runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];
  27.  
  28. [ball retain];
  29. }
  30. }
  31.  
  32. 2011-06-29 20:44:04.121 ballgame[3499:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HelloWorld spriteMoveFinished:]: unrecognized selector sent to instance 0x605a3e0'
Add Comment
Please, Sign In to add comment