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 / AdvancedSPRITES problem

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 24th Feb 2011 21:38
i am having problems with this code one function is placed outside main do loop and other one inside of it, the problem is that i can't draw a sprite on the screen and my program crashes with 'could not read memory at address' sort of error? here is the code



what i want is to get this image in lower right corner of the screen
Admiral MH
15
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 24th Feb 2011 22:09 Edited at: 24th Feb 2011 22:10
LegendSpr has to be a global variable. That's what causing the crash. And for drawing the sprite at the lower right on the screen.



Also remember to make sure you also have "dxs initialize" at the start of your program.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Feb 2011 05:20
You might as well make "LoadInterface()" a subroutine instead so you can globalize your "LegendSpr" pointer.

Also remember that multiple "dxs begin sprite render" and "dxs end sprite render" during each loop will drastically slow down your fps rate. If you use many sprites, bundle your sprites into a sprite pack and try to run as few render calls as possible.

Login to post a reply

Server time is: 2026-07-17 13:59:45
Your offset time is: 2026-07-17 13:59:45