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 Discussion / sprite frame problem

Author
Message
Ed222
18
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 12th Jan 2008 01:55
I need somehelp with my sprite see the download when ever I press the up or downkey it plays the whole frame once the plays the ones I want is there any way to fix this??

Windows Is better than everything
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Jan 2008 03:53
Whatever you are using (I assume a variable) to set the sprite image is where I expect the problem will be found. It would help if we could see the section of code where you move the sprite up/down. I would compare what you are doing differently on the up/down versus the left/right (other than the images themselves, of course), as the left/right seems to be working okay.

Note: I think most people prefer not to have to load an .exe to troubleshoot.

LB
Ed222
18
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 12th Jan 2008 17:16 Edited at: 12th Jan 2008 17:19
actually I inculded the source code and media files on download and i attached it to this post too its an sfx self extracting files since some people don't have winrar

Windows Is better than everything
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Jan 2008 21:22
Why not just put the movement code in a snippet? This download installs the files on your computer. Why would I want to go to the trouble/risk of doing that to help you out? If you post it in a snippet I will see what I can do to help.

LB

Ed222
18
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 13th Jan 2008 03:59
wow you must have no exp with sfx files they don't install the files they only extract anyways heres the code


Windows Is better than everything
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 13th Jan 2008 21:05
I don't want to belabor the point, but the files would be installed on your computer.

Anyway, the fix is easy. When you are moving up or down, your code does not check to see if the framenumber is at the minimum image # for moving up/down. Let's say you're walking left and the current framenumber is 3 and then you press up. Your code simply adds one to framenumber without checking. So, even though you are pressing up, it would display image 4. From your code, I can tell that image 7 is where the up images start. You won't notice it going from up/down to left/right, because you check if the left/right images are > 6, which it always will be if you previously moved up/down.

You should code it so that when up is pressed that you check to make sure framenumber = 7 at the minimum. The same goes for the down, only the minimum should be 16. This should take care of it.

LB
Ed222
18
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 13th Jan 2008 22:58
thanks

Windows Is better than everything
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 14th Jan 2008 03:17
You're welcome. Sometimes it just takes a second set of eyes.

LB

Login to post a reply

Server time is: 2026-07-05 16:07:22
Your offset time is: 2026-07-05 16:07:22