Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <CCLayerObject>.isTouchEnabled = YES;
  2.  
  3. -(void)registerWithTouchDispatcher
  4. {
  5. [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
  6. }
  7.  
  8. -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
  9. {
  10. CGPoint point = [self convertTouchToNodeSpace:touch];
  11. NSLog(@"X:%ftY:%f", point.x, point.y);
  12. }
  13.  
  14. [self setUserInteractionEnabled:YES];
  15.  
  16. - (void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
  17. NSLog(@"touchBegan");
  18. }
  19.  
  20. [self setMultipleTouchEnabled:YES];
  21.  
  22. self.userInteractionEnabled = TRUE
  23.  
  24. - (void)touchMoved:(UITouch *)touch withEvent:(UIEvent *)event
  25. {
  26. CGPoint touchLocation = [touch locationInNode:self];
  27. currentHero.position = touchLocation;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement