cocos2dx教程之CCAction

实现Node的动作,主要分为即时动作和延时动作

+(id) action

-(void) startWithTagert: (id)aTarget

-(void) stop

-(void) isDone

-(void) step

-(void) update

-(void) pause

-(void) unPause

-(BOOL) isRunning


 CCActionIntervalmoveToAction = CCMoveTo::actionWithDuration(2,ccp(size.width - 50, size.height - 50));  

    //CCActionInterval是延时动作,与之对应的是CCActionInstant即时动作  

    //CCMoveTo每次执行都到达指定的地点  

    //actionWithDuration第一个参数是设置动作的时间(秒),第二个是动作最终的坐标位置  

    CCActionIntervalmoveByAction = CCMoveBy::actionWithDuration(2,ccp(80, 80));  

    //CCMoveBy每次执行,x坐标增加80y坐标增加80  

    CCActionIntervalmoveBackAction = moveByAction->reverse();//按相反的方式返回,即x坐标减少80y坐标减少80  

      

    //m_player->runAction(moveToAction);  

    //m_player->runAction(moveByAction);  

    //m_player->runAction(moveBackAction);  

    m_player->runAction(CCSequence::actions(moveByActionmoveBackAction, NULL));  


你可能感兴趣的:(cocos2d-x教程,CCAction)