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 / How to print text over sprites

Author
Message
Morb
16
Years of Service
User Offline
Joined: 28th Aug 2009
Location:
Posted: 19th Jun 2010 04:53
I am currently trying to make a tower defense game and when I do print stuff (like tower info) on the Hud window(wich is a sprite), the text appears UNDER the sprite (I know because it doesnt display, but when I remove the Hud sprite, I see the text). I tried setting the sprites priority low, and it does not change anything. I was wondering if there is a workaround for this situation since I don't want to use more sprite for my text (well I will if its the only way..)
maicl
19
Years of Service
User Offline
Joined: 19th Jun 2007
Location:
Posted: 19th Jun 2010 08:03 Edited at: 19th Jun 2010 08:06
use : "draw sprites first" before the main loop!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 19th Jun 2010 15:21
Use Paste Sprite and hide the real sprite.

Rawwrr. Sig Fail.
Newcastle is awesome
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Jun 2010 15:48
What mad nightmare said.

My signature is NOT a moderator plaything! Stop changing it!
The ace of the spade
17
Years of Service
User Offline
Joined: 8th May 2009
Location: Everywhere
Posted: 19th Jun 2010 16:22
Or you could implement sprite text.

“It is not clear that intelligence has any long-term survival value” -Stephen Hawking
Morb
16
Years of Service
User Offline
Joined: 28th Aug 2009
Location:
Posted: 19th Jun 2010 16:28
Quote: "Use Paste Sprite and hide the real sprite.
"


Can you give more details?

My "hud" window is made before main loop I did something like that



Now it works for the text but my hud window (wich is sprite 1) never reappears...
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 19th Jun 2010 17:02
Try creating your sprite off the rendering area.
E.g. sprite 1, -9999, -9999, 1

Perhaps hiding the sprite stops paste sprite working. Only guessing here I'm afraid as I never use the built in sprites.

Also, if you're using print in a loop, you will need to reset it each time with 'set cursor 0, 0' otherwise the text will keep going further and further down the screen. I don't know again if maybe this is disrupting the correct rendering of your sprite.

COFFEE COFFEE COFFEE...I've had to much you say? NONSENSE! CANNEVERHAVETOOMUCH!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jun 2010 17:23
@Morb,
This is something that is so easy to do now. Just follow these steps:
1. Download and install my plug-ins
2. Use the DRAW SPRITES MANUAL command to take control of sprite drawing yourself.
3. Use the DRAW SPRITES command to draw the sprites wherever you wish in your draw sequence.



In your case, you would draw your background first, then draw the sprites, then finally draw your text.

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 20th Jun 2010 00:03
Oh, i somehow missed this thread, else i would suggest same as IanM, i use his plugin just the way he showed in his example.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
maicl
19
Years of Service
User Offline
Joined: 19th Jun 2007
Location:
Posted: 20th Jun 2010 02:53 Edited at: 20th Jun 2010 02:55
see this example :


or you can use IanM's one !
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jun 2010 05:31
Sprite n, x, y, img
hide sprite n

do
Paste sprite x, y
loop


Text will show on top as will other drawing commands.


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke
The ace of the spade
17
Years of Service
User Offline
Joined: 8th May 2009
Location: Everywhere
Posted: 20th Jun 2010 09:00
You mite want to look into implementing sprite-based text, because in general, it provides more ways to manage your text, and would of course play well with sprites.

“It is not clear that intelligence has any long-term survival value” -Stephen Hawking

Login to post a reply

Server time is: 2026-07-25 08:29:26
Your offset time is: 2026-07-25 08:29:26