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 / Problem with sprite animation

Author
Message
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 9th Oct 2009 00:10 Edited at: 9th Oct 2009 00:10
I'm creating a 2D character sprite which will be controlable with the left and right keys. I'm inexperienced when it comes to 2D coding so it's probably very easy to accomplish what I want. Anyway, I have the sprite set up and I can move the sprite to the left and right directions.

The problem though is that I want a specific frame to play when the character stop moving. Or, to simplify a little:

When leftkey is pressed, move sprite left and play walking animation
When leftkey is released, I want the sprite to change to a standing person, depending on what way the player moved before, the player will face that way.

I have tried using flags, but with no success.

Here is the code so far:



If anyone can spot what I did wrong, please notify me and I'll be very greatful. Helping me solve the problem will be very much appreciated. Thanks.

nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 9th Oct 2009 00:22
I just realized that I should not program while tired.. I tried to use an over complicated method, which, obviously, does not work. I solved the problem flawlessly by using a much more simple code.

Problem solved!

Login to post a reply

Server time is: 2024-11-25 01:29:59
Your offset time is: 2024-11-25 01:29:59