Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 2D Walking Animation

Author
Message
Dark Frager
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: The Void.
Posted: 21st Apr 2013 18:56
Hi!

Is there a code snippet for a 2D walking animation somewhere?

If anyone one knows could they please post a link?

Thanks!

Level 100 Forumer - 456,000 Health, 264,543 Keystroke Power.
Special Abilities: Flame Resistance, Troll Shield.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Apr 2013 00:02
What do you mean? Like a skeletal or bone system?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Dark Frager
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: The Void.
Posted: 22nd Apr 2013 09:45
I mean like a system where you press a button to go right, and then the sprite changes to the image of the character walking right, and so on.

Level 100 Forumer - 456,000 Health, 264,543 Keystroke Power.
Special Abilities: Flame Resistance, Troll Shield.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Apr 2013 22:18
Here's the sprite sheet I'm going to use in my example:
http://atomicrobotdesign.com/blog_media/sprite_movement/images/gb_walk.png




But in that example, you'll notice sometimes the old selected animation sequence will finish playing before it moves to the new one when you change directions. To fix this, we need to set the sprite's current frame whenever the sequence changes.

To do that, I created an array of a custom UDT to help store the different animation sequences. This will help out a lot when you have several different types of animation sequences to manage. The constants simply help keep things organizes, allowing me to easily see which array element corresponds with each animation.




"You're all wrong. You're all idiots." ~Fluffy Rabbit
Dark Frager
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: The Void.
Posted: 23rd Apr 2013 00:10
Thanks!

Level 100 Forumer - 456,000 Health, 264,543 Keystroke Power.
Special Abilities: Flame Resistance, Troll Shield.

Login to post a reply

Server time is: 2024-11-23 15:13:18
Your offset time is: 2024-11-23 15:13:18