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.

2D All the way! / Text over sprites

Author
Message
oli chose123
18
Years of Service
User Offline
Joined: 18th Aug 2006
Location:
Posted: 16th Apr 2007 15:50
I've been trying to get text and variables to show on sprites in my small game, but i doesn't seem to do anything. My first guess would be that the text is drawn under the sprites, if that's even posible. Any ideas?

Thanks
MonoCoder
19
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 17th Apr 2007 19:51
Sprites are rendered over the text by default. To get text over them, you should hide them, use paste sprite to draw them, then add the text after pasting.

LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Apr 2007 04:04 Edited at: 20th Apr 2007 16:29
You could paste the sprite, print the text on it and then grab the image and use it for your sprite.



Really, this could be done by simply pasting an image on the screen (or to a bitmap), printing text on top of it and then grabbing the image for sprite use, so it does not have to be done this way.

LB
aluseus GOD
18
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 21st Apr 2007 19:10


reformatted to actually work....

Can you make the area around text transparent?

I will Learn to rule 2d. Someday...
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Apr 2007 03:12
@aluseus

Excuse me??? The request was
Quote: "I've been trying to get text and variables to show on sprites in my small game"


Where do you get the idea that the code had to be reformatted to actually work? The code draws text on a sprite as requested and works fine. Your reformatted code additionally leaves a sprite on the screen, but what does that have to do with putting text on a sprite? How do you figure that the code needed to be reformatted?

LB
aluseus GOD
18
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 22nd Apr 2007 22:26
Sorry, it's just that the code didn't work for me when I tried it.
But it's probably just me, sorry!

I will Learn to rule 2d. Someday...
oli chose123
18
Years of Service
User Offline
Joined: 18th Aug 2006
Location:
Posted: 26th Apr 2007 01:34
thanks a lot, it works well now
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Apr 2007 07:00
@ oli chose123

I'm glad to hear it helped. I know that it tested fine for me.

LB
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 30th Apr 2007 08:00
You can also add to LBFN's snippet so it does all the pasting and grabbing on a hidden bitmap - useful if you have a lot to do and don't want to see it happen.

TDK_Man

Cabe
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: Glasgow, Scotland
Posted: 7th May 2007 20:30
^^ I did something similar to that



My code uses a set of number sprites (i.e. 1.bmp, 2.bmp etc) and can support values up to 9,999,999
I used this to display the players score in a 2D game.

Login to post a reply

Server time is: 2025-08-09 02:15:28
Your offset time is: 2025-08-09 02:15:28