Hello all,
So I’ve created a Sprite and I’ve animated it. This works great but I also want to move the sprite during certain frames of animation. I’ve kind of accomplished this by creating an animationupdate listener. IN the example below I will move the sprite to the left by 10 pixels every time the animation plays frame #2:
function animationUpdate(animation, frame, gameObject) {
if(frame.index==2)
sprite.x+=10 ;
}
sprite.on("animationupdate-mySprite", animationUpdate) ;
Is this the correct way to move a sprite during certain animation frames or is there a better way?