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 / Best way to.. Animate Sprites?

Author
Message
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 9th Jan 2009 22:33
What is the best way to animate sprites,that you are controlling? I have tried doing simple left,up,right,down controlls,and an animated sprite with dimensions of 3x4. I have done the animations but this is not working properly. For example: I hold right Key,I am walking very nice and smooth,but when I press left,I can see UP and DOWN animations till it turns to LEFT Any advices of making an animations?

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 9th Jan 2009 23:40
Maybe dbSetSpriteFrame is what you need.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 11th Jan 2009 14:37
Your problem is that it is playing all the frames instead of just the ones you need for the action? You could always use different sequences depending on the state of what the sprite is doing like:

if (state == MoveUp) FirstFrame = 1; LastFrame = 5;
if (state == MoveLeft) FirstFrame = 6; LastFrame = 10;

dbPlaySprite(MySprite, FirstFrame, LastFrame, Delay);

So that you specify somehow what range if frames are used for the action.

Or you could use dbSetSpriteFrame or dbSetSpriteImage to make your own animation function.
Swampert
15
Years of Service
User Offline
Joined: 17th Dec 2008
Location: Somewhere in the Interwebs
Posted: 11th Jan 2009 23:36
I suggest dbSetSpriteFrame() so you have more control

GDA - Game Developers Anonymous - Get in touch with your creative side.

Yeah I like Pokemon... so what?
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 12th Jan 2009 08:33 Edited at: 12th Jan 2009 08:34

Login to post a reply

Server time is: 2024-11-25 11:15:15
Your offset time is: 2024-11-25 11:15:15