Animation

Started by
0 comments, last by ZeroRage 24 years, 9 months ago
I am attempting to go about with my first game. Rather than going full blown into a 3d game, i want to make a 2d game and am wondering about animation. Dirty rectangle, double buffering, page flipping, these are all fine, but I am having a difficult time deciding how to implement the different levels of animation. Example say the main character is standing there going thru the anim. Now the player hits the left arrow (or whatever moves him left), how do I make it so that the longer the button is held, the faster the character moves, and with speed changes animations. I was think about as the speed increases, there would be a limit for each set of animations, say if character speed is > 20, use the second set,
if > 30, use third set, etc. Just want to know if anyone more experienced has some better solution that would like to spread the knowledge???
Advertisement
well one way is to set a timer and check for a key press every XX miliseconds. Each time the timer beeps (gets to the desire time) it reduces the speed by 1 and every key press (should be checked in the same interval as before) 2 values are added to speed so you will have a linear accelaration, and you can do like

[PSEUDO CODE]

if direction = LEFT

if keypressed = RIGHT

then

speed = speed - 2

if keypressed = LEFT

then

speed = speed + 1

end if

speed = speed - 1
[PSEUDO CODE OVER]

just a suggestion, if you want realistic movement, like car movement or something just let me know and i'll explain

bye

------------------
Bruno Sousa aka Akura
Founder and programmer - Magick.pt
[mail]magick_pt@geocities.com[/mail]
http://magickpt.cjb.net

It's good to be an outcast, you don't need to explain what you do, you just do it and say you don't belong there.

This topic is closed to new replies.

Advertisement