Advertisement

Animation

Started by July 16, 2000 01:21 PM
1 comment, last by vbisme 24 years, 5 months ago
A nice explaination about animation in games would be nice. Let''s say you have a dog sprite with 3 frames for walking and a cat sprite with 5 frames for jumping, how would you animate them both at the sametime on screen? Would be sprite need to have a function something the Animate()? if so how would it work? In the book "Windows Game Programming for Dummies", it mentioned a BOB or something like that. I couldn''t understand how it works. And about the GPDUMB engine, there was no codes for the functions to explain and give a little example. HELP!!!!!!!!!!!!!!!!
First start be maintaining a list of animations that are currently being displayed. Every program loop (this can't be event based unless you are using a timer) draw the next frame in the animations if the delay has reached 0. If you try to draw a new frame of the animation every program loop the animation will play too fast, so you will have to use delays.

psuedo-code:
for every program loop:
--- for every animation
------ if delay > 0 then delay--
------ if (delay == 0):
----------- animation_frame++;
----------- delay = 10 <---whatever the delay is
------ draw animation's current frame at x,y

hope this helped


Edited by - neverlast on July 16, 2000 6:02:14 PM
Advertisement
A BOB is something that the author of the book kind of made up basically.

He makes functions that basically do the Directx stuff for you for the most part.



"The road of excess leads to the palace of wisdom." --William Blake

"The road of excess also just ends making me tired because I'm too lazy" --Nazrix
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement