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.

Dark GDK / Help with movement animations

Author
Message
BeanerT
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location:
Posted: 16th May 2010 22:37
We have a sprite sheet with 46 sprites on it currently. The sprites for moving right are from 1-10, and the sprites for moving left are from 24-33. Using "dbPlaySprite" to play the animations for moving right and left look like this:

//right
dbPlaySprite(1, 1, 10, 60);
//left
dbPlaySprite(1, 24, 33, 60);

It works, however, if you move right and then switch to moving left, the sprite will play through sprite numbers 10-24 initially, and then loop through 24-33. We want it to immediately loop through 24-33, and not go through 10-24.
Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 16th May 2010 23:42
my suggestion would be, when the key is first pressed (left or right) that you set the frame {dbSetSpriteFrame(int iSprite, int iFrame)}

so if the player presses the right direction, it would set the sprite frame to 1, if the player presses the left direction, it would set the sprite frame to 24.

hope that helps
-H

Login to post a reply

Server time is: 2024-07-07 00:06:45
Your offset time is: 2024-07-07 00:06:45