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.

Newcomers DBPro Corner / How do you put text on top of a sprite????

Author
Message
Captain Taco
19
Years of Service
User Offline
Joined: 19th Sep 2005
Location:
Posted: 22nd Sep 2005 10:07
Fairly new to darkbasic, know most 2d comands, and system commands, making an RPG in the end, and i need to have text in it, i want to put the text on top of sprites, how can i do this, every time i try, it puts the text behind the sprite... Frustration... ! grrr...

please help.

good lord that's a lot of potatos!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 22nd Sep 2005 15:33 Edited at: 22nd Sep 2005 15:34
i used to have problems with this.. but heres how to do it

hide the sprite : hide sprite num
paste the sprite (NOT show sprite) : paste sprite num,xpos,ypos


Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Sep 2005 22:24
Although using 'paste sprite' means you won't be able to use some of the sprite commands, like set sprite alpha for example. Another way is to turn your text into a sprite itself - and then you can use set sprite priority to control exactly which sprites get drawn on top of each other sprite. To turn your text into a sprite, you can use this function:



Then, any time you want to write some text, just write:

text_over_sprite(spritenumber,x,y,text)



Louiz ofRohr
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location:
Posted: 22nd Sep 2005 22:42 Edited at: 22nd Sep 2005 22:46
hmmm...
Nice code Ric


try this as well..



The worst foe lies within the self..
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 23rd Sep 2005 05:22
The only solution I can think of is that you're pasting the texty before a sprite is layed down. In your loop, make sure to put the text after all sprites are position.

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 23rd Sep 2005 12:33
despite the fact that the editor/compiler recognises the commands

draw sprites first

for sprites and

draw to front

for 2d I was not able to create an example that placed text over the top of a sprite, the functions either don`t work or only apply to priority over 3D objects, no way of knowing which since the manual isn`t exactly helpfull on that point.



the average IQ is 100...but the people that took the test where trying to look smart. most people don`t go over 50.
Area 51?, I`m more intrested in what they have in areas 1 to 50

Login to post a reply

Server time is: 2024-11-27 16:37:37
Your offset time is: 2024-11-27 16:37:37