Archived

This topic is now archived and is closed to further replies.

Animation

This topic is 6724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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???

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites