Jump to content

Play a sprite animation starting in the middle?


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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