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 Discussion / need Sprites help please

Author
Message
loftin
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 15th Feb 2007 17:13
Can i put anything in front of sprites such as text. if so please post the code to do so.

yo!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Feb 2007 18:46
What exactly do you mean by "in front of"?

TDK_Man

Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 15th Feb 2007 18:58 Edited at: 15th Feb 2007 18:59
@TDK
1- Paste a sprite
2- Paste some text on top of that

I have no idea on how to do that, maby transform the text into a sprite and paste it then.

Don't look at my sig!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Feb 2007 19:10
Ah OK - you meant on a sprite! With you now...

As you have discovered, you can't put text on a sprite in DB as sprites appear over everything.

But there's a work around - though it's a pain.

What you do is create a second (hidden) bitmap, paste the sprite image onto it and then use the Text command to add the required text.

You then grab the old image and text as a new image and use that to create your sprite.

You need to do that each time if the text changes.

It's a pain I know, but it does work. Shout if you need further help on how to do it.

TDK_Man

Robot
22
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 15th Feb 2007 23:21
A much easier way is to use the paste sprite command, possibly with the hide sprite command and sprite command to allow for collision.
Basically just hide the sprite and position the sprite where you want it to be (this is only if you want inbuilt sprite collision). Paste the sprite using the paste sprite command,
then add the text.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Feb 2007 23:36
Quote: "then add the text."


That's the whole point of the post - you can't!

TDK_Man

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Mar 2007 16:17 Edited at: 6th Mar 2007 17:43
I think Robot's method is sound. However, it wouldn't actually create a sprite with text on it, but paste a picture of the sprite on the screen with the text. And if the position of the sprite was updated, it could still detect the collision even though it was hidden. I wonder if this would be a performance increase since the sprites are hidden - yet the behavior is still sprite-like?

Here's an example:



It seems you could also change sprite priority this way by hiding all of the sprites and then pasting them in order of greatest priority (which ones are on top).



Enjoy your day.

Login to post a reply

Server time is: 2026-07-06 15:44:24
Your offset time is: 2026-07-06 15:44:24