Skip to main content
gamedev.net
🔒 Locked

SDL Animation

Started by Megafox 4 replies 750+ views
Original Post
Megafox
Megafox
Hi. I have been fooling around with SDL for a while now and know how to init and draw a bitmap ( part of a bitmap ) to a sdl surface and even to make it move. So here is the question. I currently have a pong clone going, the ball is bouncing perfectly etc etc, but now i want to make the ball more 'realistic' ( iow i want it to animate while travelling ). All i want it to do is cycle 8 ball bmps every second to simulate rolling. How do i go about doing this?
Rob Loach
Rob Loach
I would create a list of SDL_Surface's and then create a timer class that would help you find out which surface to display.
Rob Loach [Website] [Projects] [
Lazy Foo
Lazy Foo
I have a tutorial on it.

It's tutorial 17.
Learn to make games with my SDL 2 Tutorials
Megafox
Megafox
thanks guys! Ill have a look!

EDIT:

got it working!! the animation is working perfectly, now just to add the velocitys to make it move.

[Edited by - Megafox on December 14, 2005 5:36:20 AM]
samuraicrow
samuraicrow
Quote:
Original post by Anonymous Poster
Then, your done. Just remember not to go out of bounds.


You could bound check that quicker using a modulo operator:

Frame%=AllFrames.size();

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.