我想將我從一個數組中調用的精靈分組,以便我可以將它們作爲一個組移動。我被告知使用cocosnode,但我很確定他的意思是ccnode。這裏是我的代碼到目前爲止:分組精靈並移動它們?
sprites1 = (CCSprite *)[c1array objectAtIndex:0];
sprites2 = (CCSprite *)[c1array objectAtIndex:1];
sprites3 = (CCSprite *)[c1array objectAtIndex:2];
sprites4 = (CCSprite *)[c1array objectAtIndex:3];
sprites5 = (CCSprite *)[c1array objectAtIndex:4];
sprites6 = (CCSprite *)[c1array objectAtIndex:5];
sprites7 = (CCSprite *)[c1array objectAtIndex:6];
sprites8 = (CCSprite *)[c1array objectAtIndex:7];
column1 = [CCNode node];
[column1 addChild:sprites1];
[column1 addChild:sprites2];
[column1 addChild:sprites3];
[column1 addChild:sprites4];
column1.position = ccp(0,0);
[self addChild:column1];
column2 = [CCNode node];
[column2 addChild:sprites5];
[column2 addChild:sprites6];
[column2 addChild:sprites7];
[column2 addChild:sprites8];
column2.position = ccp(30,0);
[self addChild:column2];
//ccotouchmoved code
column1.anchorPoint = ccp(touchLocation.x,touchLocation.y);
if (CGRectContainsPoint(c1,touchLocation)) {
touchLocation.x = column1.position.x;
column1.position = ccp(touchLocation.x,touchLocation.y);
}
如何使ccnode平穩移動。它跳了很多,但我想上下平滑過渡。
XXX
XXX
XXX
X是我的精靈我正在向下和向上移動我的x作爲整列並需要能夠到我的X移動作爲整行,以及一旦它離開屏幕的頂部,我需要它重新出現在屏幕的另一側,反之亦然,左側和右側。
崩潰時有什麼錯誤? – lins314159 2011-03-31 22:56:00