我用什么概念来移动精灵对象(COCOS2d)?

时间:2010-12-17 04:44:11

标签: iphone objective-c xcode cocos2d-iphone

我正在制作cocos2d-iphone游戏,我对cocos2d中的动作或任何概念移动我的精灵对象有疑问。给定一个点数组(x,y坐标)。 .... 例如:

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 floatValue],[strTempY floatValue])];
 [m_seeker runAction:move];
}

.... 这里发生的是runAction只执行第一个循环或第一个循环(x,y),然后循环跳过其余循环。

我的点阵数来自设备中的用户触摸点,因此这不是固定的。

提前Thanx!

1 个答案:

答案 0 :(得分:0)

您应该创建一个CCSequence来一个接一个地运行许多操作,然后告诉目标使用该序列运行ActionAction。