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.

DarkBASIC Professional Discussion / Animated sprites problem

Author
Message
Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 28th Jul 2010 04:33 Edited at: 28th Jul 2010 04:34
I'm having a problem with animating my sprite. simply, when I hold the up key it animates from frame 1-3 fine, but if I start holding the left key after I let go of the up key it goes through all the frames from 1-10 before animating like normal (10-12). This is obviously a big problem and I can't figure out why it's happening so any explanation/solution would be appreciated. Also, on a side note, the "set image colorkey" command isn't working for my sprite (attached) again, any solutions are appreciated.

Source:
leo877
18
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 28th Jul 2010 06:56 Edited at: 28th Jul 2010 07:01
hi, i am learning dbp...i don't know how to help on the Animated sprites problem but ur
Quote: "the "set image colorkey" command isn't working for my sprite"
. did u enable transparency option in ur paint program. which one do u use....i use the promotion V5.1.[i add a download .just rename it.......hope it helps...


leo877
18
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 28th Jul 2010 07:02
trying to put an image but couldn't..sorry for second post.


LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Jul 2010 07:58 Edited at: 28th Jul 2010 08:01
If you convert your .png file to a .bmp file, it will work with the colorkey ( the edited code here calls for it).

As to the sprite frame issue, what is happening is definitely weird. What I did to work around it is to check the current frame of the sprite against the intended animation frame to be played. If the frame is not within that particular range, it is set to the first frame of the animation.



Also, I added some variables so that you only check for a keypress when the animation is done playing. You may not like it like that, but it seems like that unless you hold the button down, the animation won't play fully. Since they are very short animations, I didn't figure it would be a problem.

EDIT: Oh, I made the sprite bigger too. It was so small it was hard to easily see the animation. Just take out the scaling on it.

Anyway, I hope this helps you.

So many games to code.......so little time.
Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 28th Jul 2010 22:34
cheers. that's gonna have to do, it's not perfect, but it's a lot better than it was. thank you =)

Login to post a reply

Server time is: 2026-07-25 23:51:36
Your offset time is: 2026-07-25 23:51:36