-1

I'm making a simple game using Cocos2D. The user can touch and trace a path for small moving objects. The objects then follow the path. This is similar to the Flight Control game mechanic.

how i can move the object like that.please help me to get out of this problem.any sample code or tutorial will help me more thank you .

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Appsunic
  • 192
  • 1
  • 10

1 Answers1

0

In your touchesEnded/touchesMoved method try and do this :

UITouch *touch = [touches anyObject];

if (touch) {
    CGPoint location = [touch locationInView:[touch view]];
    CGPoint convertedPoint = [[CCDirector sharedDirector] convertToGL:location];
    id animation = [CCMoveTo actionWithDuration:0.1 position:convertedPoint];
    [playerShip runAction:animation];
   }
Shailesh
  • 3,072
  • 3
  • 24
  • 33