Jump to content

Play a sprite animation starting in the middle?


adamyall
 Share

Recommended Posts

I have a jump animation and a midair movement animation.
The jump animation is 5 frames long, and I want it to play all the way through when the player jumps from a grounded state. However if the user jumps starting from the ground, then starts to move left or right, it plays the midair movement animation. Now, when the user stops moving, I want to transition back to jumping, but starting at frame 4 or 5 of the jumping animation.

sprite.play(name);sprite.animations.frameName = frameId;

I've also tried using animations.frame = number, but no luck with that either. I just need to know if there's a play, but skip to frame method that I'm not seeing.

Link to comment
Share on other sites

Maybe create multiple animations with different names for the jump. Then keep the standard jump animation but if jumping and velocity is + or - then play another animation with the fraames required. Then the falling animation can be created to play when the velocity on y is + or -.

Basically, split it into multiples, set the velocities per animation and test.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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