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 / Can't see PRINT/TEXT with sprites

Author
Message
Caeknommer
12
Years of Service
User Offline
Joined: 20th Mar 2013
Location:
Posted: 20th Mar 2013 12:20
I understand that once you start loading sprites DBpro basically gets into "3d mode" - my question is when I run a very simple program with a sprite, why can I no longer see PRINT or TEXT? Simple example:

Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 20th Mar 2013 21:05
You need to keep drawing the text on every frame, currently you are drawing the text on one frame, then the engine draws new frames while the sprite (technically part of the 3D GPU API) is being redrawn.

Use something like this,



Assuming sync has not been turned on. If you used Sync On, put the sync command in there before the until keyword.

Sergey K
21
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 20th Mar 2013 22:11
how about hiding sprite when u creatign it, and using PASTE SPRITe command instead?



Advanced Updater for your games!
Caeknommer
12
Years of Service
User Offline
Joined: 20th Mar 2013
Location:
Posted: 3rd Apr 2013 14:35
Thanks all, that helps explain it. Another quick question though, if I slightly modify Sergey K's code:



... two things happen: the background remains black and the sprite DOESN'T restore the background. Without the SET SPRITE command the background goes the usual blue and background is restored. It doesn't seem to matter whether the backsave flag is set to 1 or 0, the result is the same.
Ramus73
15
Years of Service
User Offline
Joined: 24th May 2009
Location:
Posted: 5th Apr 2013 00:29
Thats because you are pasting it to the screen. When using paste sprite you need to redraw the background before moving and pasting again. If you put cls 0 before the paste sprite command it will do what its supposed to (the cls is where you would redraw background elements). If you are just pasting a sprite to the screen I usually keep it off the actual screen (sprite 1,-5000,-5000,1). You don't need the hide sprite command then. Note: if you intend to use collision detection you need to have the sprite on screen.

Login to post a reply

Server time is: 2025-05-17 15:47:27
Your offset time is: 2025-05-17 15:47:27