views:

1256

answers:

2

hello, I trying to develop a game for iPhone by using cocos2d. I need DRAG option in cocos2d. Is it possible to implement drag option in cocos2d ?

A: 

Its done well:

-(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [touches anyObject];

    CGPoint location = [touch locationInView: [touch view]];
    CGPoint convertedLocation = [[Director sharedDirector] convertCoordinate:location];
        //start ur logical code

}
Nahid
A: 

To drag you can simply set the sprite's center to the location of the current touch coordinates.

See the Apple Dev Sample: MoveMe I think this will help.

Are you trying to create a pathfinding game like Flight Control or Harbor Master? Please explain with more detail what you are trying to achieve.

TouchGameDev