Jump to content

Stop the animation at last frame - libgdx


Jaka

Recommended Posts

I need some help with playing the animations. I would like to stop one animation at the last frame, and i cant figure it out how. Using the listener and stopping the animation after "animation finished" flag triggers, returns the first frame of animations. Or even setting the playback of the animation to 1time and not looping would be ok.

I am working with libgdx.

Thank you for the help
Jaka

Link to comment
Share on other sites

Well that is basically what I have. In my AnimationListener -> animationFinished(), I have a boolean that goes true when finished.

Then in my game update I check for that boolean, if true i set player.speed = 0

After that I call player.update().

What i get with this is the animation stops at the first frame, not the last frame. What is this line (player.time = player.getAnimation()) supposed to do?

 

Thanks for the help.

 

EDIT:

Ok, I understand the player.setTime now and its working :) Thank you very much. Still I dont understand something. My animation time is 782. If I set the player.setTime(782) or player.setTime(player.getTime) I get the first frame. If I set the time to 781 it works great. Looking at the animation itself in spriter, at the 782 time I have the correct last frame. Does the spriter count maybe start from 1 and in libgdx it goes from 0?

Edited by Jaka
Solved the problem
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.

Guest
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...