Jump to content

Playing animation from current frame


6regor
 Share

Recommended Posts

How would you go about ensuring that an animation continues to play from from the frame that it stops on instead of from the first frame?

 

It is a rotating type thing:

sprite.animations.add('clockwise', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 7, true, true);sprite.animations.add('anticlockwise', [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 7, true, true); 

and the arrow keys control rotation:

 if (cursors.left.isDown){                   sprite.animations.play('clockwise');     }    else if (cursors.right.isDown){                sprite.animations.play('anticlockwise');    }        else{        sprite.animations.stop();    } 

But I can't figure out how to have the animations not reseting each time an arrow key is pressed.

 

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...