Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Playing an animation only once

Author
Message
MegaMuse
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Munich
Posted: 7th Feb 2009 10:30
Hello everyone,
I'm very new to this so bear with me . What I want is to have the animation of an animated sprite play through completely, but only once. There is probably a simple solution to this, but I can't think of one. The only thing I could think of is making a loop that always increments the current frame of the animation manually and stops at one point, but I think that would be too complicated seeing as that would probably require me to work with the processor speed wouldn't it?
So, I'd love to hear how this problem can be solved and am greatful for every bit of help!
-Chris
Kilrath
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Alberta
Posted: 7th Feb 2009 17:07
this is how i handled it.... worked on multiple computers with different processor speeds.


Only thing is you have to run it a few times to get the right number of loops.

Saving the world, one bit at a time.... Wait it's not worth saving. Get your own bits!
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 7th Feb 2009 19:03 Edited at: 7th Feb 2009 19:03
edit: nvm. wrong thread
MegaMuse
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Munich
Posted: 7th Feb 2009 21:18
thanks kilrath, but it's not quite what I was looking for. I wasen't detailed enough with what I really wanted:

I'm building a football-based game and when somebody scores a goal (the ball is behind the goal line), the animation of the net moving plays, but only once. I thought of a way to solve it that should work but it doesn't. I have a function with conditional statements that executes the appropriate commands when the ball passes the line. This function does things like reset the balls position to the middle and increase the player's score. I thought it would be a good idea to increase the frame of the goal animation by 1 in this function, and in the main game loop I check if the Sprite's frame is greater than one. If it is, play the animation....so it should stop after playing once right? Why doesn't work?

Thanks!

Login to post a reply

Server time is: 2024-11-25 13:18:40
Your offset time is: 2024-11-25 13:18:40