开发者

What concept shall i used to move a sprite object (COCOS2d)?

Im currently making a cocos2d-iphone game and I have a question on what action or any concept in cocos2d to move my sprite obj. given an array of points(x,y coordinates). .... For example:

for (int nCtr = 0; nCtr < [m_ArrayPosition count]; nCtr++) {
        dictionary = [m_ArrayPosition objectAtIndex:nCtr];
 arrayPoints = [dictionary objectForKey:@"Points"];
 strTempX = [arrayPoints objectAtIndex:0];
 strTempY = [arrayPoints objectAtIndex:1];
        id move = [CCMoveTo actionWithDuration:.1 position:ccp([strTempX开发者_如何学Go floatValue],[strTempY floatValue])];
 [m_seeker runAction:move];
}

.... What happened here is that the runAction will only execute the first loop or first (x,y) and then the loop skips the rest.

My array of points is from the users touch point point in the device so this is not fixed.

Thanx in advance!


You should created a CCSequence to run many actions one after another, and then tell the target to runAction with that sequence.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜