checking if an SKNode is running a SKAction

非 Y 不嫁゛ 提交于 2019-12-04 04:25:42

Look at using named actions using any of the SKAction key-based methods. So you would instead run your action using the named equivalent to runAction: which is runAction:withKey:. If an action with the same key is already running, it is removed before the new one is added. Alternatively, use actionForKey: to see if an action is already running like you are trying to do now in your code, then removeActionForKey: to remove it or handle as needed.

Sorry for the late answer, but you can use the sprite method hasActions to check if a sprite is currently running any actions.

if (![mySprite hasActions])
{
   [mySprite runAction:action];
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!