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 / Text over sprites

Author
Message
MrSteve
21
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Omnipresent
Posted: 7th Apr 2010 00:52
Hey Gang, do any of you clever people know how I might display my text over a sprite, at the moment i am using the traditional "print" command but I do know of the "text 0,0,"what"" as well. Any ideas?

A bump on the head........ is worth two in a bush?
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 7th Apr 2010 03:14
Hi, in theory ( I haven't actually done it ) you could use the "text 0,0,string" command to display text over a sprite. Just use the x and y variables of the sprite in the text command e.g "text spritex, spritey, "sprite1"". Make sure the text is drawn after the sprite though.

Hope this helps and let me know if it works.

A clever person solves a problem, a wise person avoids it - Albert Einstein
MrSteve
21
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Omnipresent
Posted: 7th Apr 2010 11:14
I do apologise I have indeed misled you, what I meant be text over sprite is that can be seen on top of a sprite, In my case, my background which is a scrolling starfield is a sprite, but this covers my screen and my text cannot be seen underneath it in a layer sense, I would like to know if there is a way to draw it on top of the background,


but thanks for the help, sorry to mislead you!

A bump on the head........ is worth two in a bush?
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Apr 2010 16:44 Edited at: 7th Apr 2010 16:46
Make sure you are doing "paste sprite" instead of "sprite". The paste sprite command is ordered as you put them in the program whereas the "sprite s,x,y,i" command has an order all it's own and has to be given a specific ordering number to render them one on top of each other. Also, if you do your "paste sprite s,x,y" before your text commands, then your text will appear on top.

EDIT:
Almost forgot! Be sure to "hide sprite s" or it will still be on top of your text.... No, the "hide sprite" will not affect your "paste sprite" command.

The fastest code is the code never written.
MrSteve
21
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Omnipresent
Posted: 7th Apr 2010 19:37
cool thanks mate, i will try that as soon as the BETA11 decides its gonna work on my machine!

A bump on the head........ is worth two in a bush?
Sepnon
16
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 7th Apr 2010 20:03
Try these:

MrSteve
21
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Omnipresent
Posted: 7th Apr 2010 20:57
okay, where in the code should that nest?

A bump on the head........ is worth two in a bush?
MrSteve
21
Years of Service
User Offline
Joined: 1st Nov 2004
Location: Omnipresent
Posted: 7th Apr 2010 20:57
of course again I will try that when DBPro works again!

A bump on the head........ is worth two in a bush?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Apr 2010 23:01

Login to post a reply

Server time is: 2026-07-26 15:31:31
Your offset time is: 2026-07-26 15:31:31