Jaka Posted January 25, 2016 Report Share Posted January 25, 2016 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 Quote Link to comment Share on other sites More sharing options...
vieZikay Posted February 1, 2016 Report Share Posted February 1, 2016 this is what i did in my animationFinished( ) method animationFinished() { player.speed = 0 player.time = player.getAnimation() player.update() } Jaka 1 Quote Link to comment Share on other sites More sharing options...
Jaka Posted February 2, 2016 Author Report Share Posted February 2, 2016 (edited) 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 February 2, 2016 by Jaka Solved the problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.