Check If animation is running in cocos2d-x

纵饮孤独 提交于 2019-12-03 14:23:20
m.ding

Assume the Sprite that runs the action is

CCSprite* bear;

I think you can use something like

bear->numberOfRunningActions()

numberOfRunningActions( ) returns an unsigned integer, so to check if there are no actions, you would have to check if it returns 0

if ( bear -> numberOfRunningActions( ) == 0 ) {
   CCLOG( "No actions running." );
} else {
   CCLOG( "Actions running." );
} 

The bearAnimate (CCAnimate) has a method to check that.

if (bearAnimate.isDone())
    doWhatYouWant();

The method is inherited from CCAction. Good luck.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!