cocos2d-x学习笔记09:动作2:持续动作
- CCActionInterval *moveByAction=CCMoveBy::actionWithDuration(0.5f,ccp(5,5));
- CCMoveBy::actionWithDuration(0.5f,ccp(5,5));//表示花0.5秒,按向量(5,5)移动一段距离
- CCMoveTo::actionWithDuration(0.5f,ccp(5,5));//表示花0.5秒,移动到坐标(5,5)
- /** @typedef bezier configuration structure
- */
- typedef struct _ccBezierConfig {
- //! end position of the bezier
- CCPoint endPosition;
- //! Bezier control point 1
- CCPoint controlPoint_1;
- //! Bezier control point 2
- CCPoint controlPoint_2;
- } ccBezierConfig;
- static CCRepeat * CCRepeat::actionWithAction (CCFiniteTimeAction *pAction, unsigned int times)
- CCFiniteTimeAction *action=getAnimate();//获得炸弹播放动画,自己实现的函数
- CCAction *sequneceAction = CCSequence::actions(
- CCRepeat::actionWithAction(action,5),
- CCCallFunc::actionWithTarget(this, callfunc_selector(Bomb::deadOnCallback)),
- NULL);
- sprite->runAction(sequneceAction);
- static CCRepeatForever * CCRepeatForever ::actionWithAction (CCActionInterval *pAction)
- CCActionInterval *action=getAnimate();//获得炸弹播放动画,自己实现的函数
- spirte->runAction(CCRepeatForever::actionWithAction(action));
- static CCFiniteTimeAction * CCSequence::actions (CCFiniteTimeAction *pAction1,...)
- CCAction *sequneceAction = CCSequence::actions(moveByAction,CCCallFunc::actionWithTarget(this, callfunc_selector(Hero::moveDoneCallback)),NULL);
- this->runAction(sequneceAction);
- CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
- {
- va_list params;
- va_start(params, pAction1);
- CCFiniteTimeAction *pNow;
- CCFiniteTimeAction *pPrev = pAction1;
- while (pAction1)
- {
- pNow = va_arg(params, CCFiniteTimeAction*);
- if (pNow)
- {
- pPrev = actionOneTwo(pPrev, pNow);
- }
- else
- {
- break;
- }
- }
- va_end(params);
- return pPrev;
- }
- static CCFiniteTimeAction * actions (CCFiniteTimeAction *pAction1,...);
- CCAction* action = CCSpawn::actions(
- CCJumpBy::actionWithDuration(2, CCPointMake(300,0), 50, 4),
- CCRotateBy::actionWithDuration( 2, 720),
- NULL);
- m_grossini->runAction(action);
- virtual CCFiniteTimeAction * reverse (void)
- CCActionInterval* jump = CCJumpBy::actionWithDuration(2, CCPointMake(300,0), 50, 4);
- CCFiniteTimeAction* action = CCSequence::actions( jump, jump->reverse(), NULL);
- m_grossini->runAction(action);