Jump to content

Enqueue tweens?


dawg
 Share

Recommended Posts

I have sprite that is animated on a board, let's say a 4x4 grid. If the user presses a button, it will move either one one square up/down or left/right. If the user presses the button multiple times, I want for it to step through the movements but as it is right now the sprite will just move diagonally to the final state. Is there a way to enqueue tweens so that each step runs asynchronously? 

Here's what the transition from one state to another looks like now, where state is the current state number and the location arrays hold the points at every state:        

game.add.tween(sprite).to({ x: locationX[state], y: locationY[state]}, 500, Phaser.Easing.Linear.None, true);

Link to comment
Share on other sites

  • 2 weeks later...

How will that work when the user input and number of moves are variable? The locations are getting fetched from a server each time a user clicks to step and a user could click through quickly or slowly. Would you just add to the function and then call them all together at some point?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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