我想使用cocos2d的
的moveTo或MoveBy方法创建以下动作当我触摸对象时应移动到那里。是否可以在cocos2d中使用?
答案 0 :(得分:0)
(void)ccTouchesBegan:(NSSet *)触及withEvent:(UIEvent *)事件{
for(UITouch * touch in touches){
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
//创建精灵集像sprite.tag = 2;
CCSprite *spr=[self getChildByTag:2];//use your sprite tag while creating
id move = [CCMoveBy actionWithDuration:4 position:location];
[spr runAction:move];