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 / Disappearing Sprites Problem

Author
Message
Thorfinn
15
Years of Service
User Offline
Joined: 21st Feb 2011
Location:
Posted: 21st Feb 2011 22:43
Hi Everyone!

Below is a very simple side scrolling application that displays a star field, places a sprite on that star field and then scrolls the star field. At some points while the application is running the sprite disappears leaving only the star field visible. After a brief period of time the sprite may reappear.



The application exhibits this behaviour when compiled and run on Windows 7 64-bit. I haven't seen the problem when running it on Windows XP Pro but it does run incredibly slowly. On Windows 7 it runs at a good speed.

Does anyone have any suggestions?

Thanks!
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 21st Feb 2011 23:02
That's rather odd behavior. Didn't see it disappear, but I am running XP on this computer.

Unrelated to the issue at hand, I would suggest locking / unlocking the pixels in your ShowStarField function, like this:


You should see a significant speed increase.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Feb 2011 03:47
Seems to work fine for me. I'm using Vista 64 bit. If speed is an issue try using SYNC RATE 0 to allow Darkbasic Pro to SYNC the screen as fast as your computer can handle it. When you do that it's best to use timers to slow down the action. Also instead of using INKEY$() use KEYSTATE() to check for keys. KEYSTATE(44) is Z and KEYSTATE(45) is X.

Thorfinn
15
Years of Service
User Offline
Joined: 21st Feb 2011
Location:
Posted: 22nd Feb 2011 22:56
Thanks for your suggestions.
Locking and unlocking pixels has made a real difference to the speed of the application on XP.

Login to post a reply

Server time is: 2026-07-17 13:57:10
Your offset time is: 2026-07-17 13:57:10