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 / Simple Question - Text over Sprites?

Author
Message
HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 03:40
I had this problem in my old LTPB programming days too...

Is there any way to put text over a loaded sprite? Right now I'm working on an FPS where I have a Status Bar BMP, and I'm trying to place text over it. However, seems as though the text always wants to stay behind the sprite.

N.E. way 2 fix it???

Thank yas
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Mar 2003 05:15
the easiest solution is to pre render your text as part of the texture or make it itself a sprite.

HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 20:13
Yes, I understand you can do that. Here's some code:

health$= "100"
set text font "Enviro"
Set text size 30
Set text to bold
tw = text width(charname$)
th = text height("A")
create bitmap 17, tw, th
text 0, 0, charname$
get image 17, 0, 0, tw, th
delete bitmap 17
sprite 17, 300, 503, 17

This code does work, however I intend to place a number over the sprite - a variable called "health". I can't use anything but strings in this scenario, and since I would obviously want to subtract from the health variable...what would I do?

Thanks a lot...

HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 20:14
tw = text width(charname$)

Make that health$...

HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 20:34
Ok, I figured out a way to make it work! I just made the sprites partially transparent.

But my problem isn't entirely solved: How can I used Center Text to position a numeric variable?

Example:
Center Text 200, 648, (numeric variable here)

Or is there some other way of displaying a numeric variable as text?

Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 12th Mar 2003 21:50
set sprite priority would also be a solution to the above problem and would meen you don't need to use the alpha channel - which might be faster /shrug

the other problem:

center text x,y,str$(numericVariable)

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 22:29
THANK YOU!

*PneumaticDryll Is God *

HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 22:33
One Question - why does it slow my program down so much?

HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 12th Mar 2003 22:39
Nevermind! fixed it

Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 12th Mar 2003 23:31
Well funnily enough the name Pneumatic Dryll comes from the name of my character in the MMORG game Everquest. I've been playing Everquest for a long time and progressed quite far in to the game, and one of the things i've done is killed my characters god...

So yeah, you could say that Pneumatic Dryll was god - for about a week until he respawned.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
HZence
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 13th Mar 2003 01:18
Lol. Yea, well you're going in the credits of this game in any case.

Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 13th Mar 2003 02:25
Please, I don't want credit for work I havn't done.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.

Login to post a reply

Server time is: 2025-05-18 23:13:51
Your offset time is: 2025-05-18 23:13:51