Actions
重复动作
//让一个节点无限旋转的例子
CCRotateBy *rotateBy = [CCRotateBy actionwithDuration:2 angle:360];
CCRepeatForever *repeat = [CCRepeatForever actionWithAction:rotateBy];
[myNode runAction:repeat];
动作序列
CCSequece *sequece = [CCSequece actions:act1,act2,nil];
[myNode runAction:sequece];
即时动作 (Place/Hide/Show/Toggle)
动作序列中,动作完成之后发送通知
CCCallFunc *func = [CCCallFunc actionWithTarget:self selector:@selector
(onCallFunc)];
CCCallFunc *funcND = [CCCallFunc actionWithTarget:self selector:@selector
(onCallFuncND:data:)];
CCSequece *sequece = [CCSequece actions:act1,func,act2,funcND,nil];
舒缓动作
XxxxTo :运动到指定位置
XXXXBy:运动到按指定x,y增量的位置
//移动过程中减速
CCMoveTo *move = [CCMoveTo actionWithDuration:3 position:CGPointMake
(100,200)];
CCEaseInOut *ease = [CCEaseInOut actionWithAction:move rate:4];
[myNode runAction:ease];
Reverse反动作
id act2 = [act1 reverse];