Search code examples
cocos2d-android

how can we use the Animation and move on a sprite simultaneously in cocos2d-android?


Animation and move the sprite of one position to another position is done but simultaneously not working. Anyone have an idea, how can I resolve it ??


Solution

  • As stated in the comments to your question, you can simply call runAction once for every action you want to run and they will run in parallel, like so

    sprite.runAction( action );
    sprite.runAction( actionMove );
    sprite.runAction( action_back );
    

    If you would want to combine your actions into one parallel action, use CCSpawn

    CCFiniteTimeAction parallelAction = CCSpawn.actions( action, actionMove, action_back );
    sprite.runAction( parallelAction );
    

    Now, running parallelAction will run action, actionMove and action_back in parallel.