Sign in to follow this  
TheNobleOne

My SDL Animation App

Recommended Posts

Ok I did not like how cone3D does animation. So I wrote my own animation algorithm. It works. Note that this has no timer in it lol. And this image does not move it just floats there and flies lol. A few modifications for instance will make this much more efficient but this was my first SDL app without the use of a tutorial so I figure I would just crack something simple out. Here it is. Oh and of course tell me what you think. I will include the Cpp in the distro if you want to look at it. Anim.zip [Edited by - TheNobleOne on December 3, 2004 8:12:08 AM]

Share this post


Link to post
Share on other sites
Nice one dude! That's pretty much how I do it.
An extension you could try adding is allowing multiple animations per sprite, and also instead of just incrementing the frame number, you can use an array of indexes so that you can control what order you draw them in, that way you can have more than one animation in the same image file.

Keep it up!

Share this post


Link to post
Share on other sites
Quote:
Original post by TheNobleOne
All I do is basically use SDL_Delay after rendering each frame and then after that increment to the next frame then do it again.
Ah. You do realise that that'll cause the animation to play at different speeds on different computers under different operational workloads at different times in different ways?

The reason people use timers for this kind of thing is because it ensures the animation won't play back stupidly fast/slow on machines different to the development machine.

[edit: well, if you're using SDL_Delay it shouldn't run faster than normal, but if your framerate drops it'll run slower.]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this