need help to create following motion
I want to crea开发者_JAVA技巧te following motion using moveTo or MoveBy methods of cocos2d
when I touch object should move there.Is it possible in cocos2d?
(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
for( UITouch *touch in touches ) {
CGPoint location = [touch locationInView: [touch view]]; location = [[CCDirector sharedDirector] convertToGL: location];
//while creating sprite set like sprite.tag=2;
CCSprite *spr=[self getChildByTag:2];//use your sprite tag while creating
id move = [CCMoveBy actionWithDuration:4 position:location];
[spr runAction:move];
精彩评论