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 / How do I draw hardware text over sprites

Author
Message
Ramus73
14
Years of Service
User Offline
Joined: 24th May 2009
Location:
Posted: 25th May 2009 07:01
Im trying to write hardware text over all the sprites on screen. No matter where I put the text (before/after,sprites/sync) the sprite are always over the text. Is there a Text To Front command or similar?
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th May 2009 14:15
Sprites are ALWAYS in front of everything. You can't change it. But you can replace all of your sprite commands with paste image <img>,x,y. Then the text will be over the image.

TheComet


Make the path of your enemies easier with Waypoint Pro!
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th May 2009 06:21
and if you want transparency use paste image img,X,Y,1 with the 1 it has black transparency.

New Site! Check it out \/
Ramus73
14
Years of Service
User Offline
Joined: 24th May 2009
Location:
Posted: 28th May 2009 12:39
Thnx Comet, after posting original I went back and used Paste. Sprites would only paste if I call the sprite first with Sprite n,x,y,i, I then paste it and Hide it, so my next question is does this take more processor time than just having the sprite displayed all the time, FPS ok atm but have close to 250 sprites so could be problem later on. I use a atan function to detect how close sprites are to player sprite and only paste sprites when in the visible screen area, does this help the FPS or should I just paste them without checking distances? Thnx for replying Oh and Caleb thnx but I think you will find that Set Sprite n,backsave,transparency is the command.
Ramus73
14
Years of Service
User Offline
Joined: 24th May 2009
Location:
Posted: 30th May 2009 06:08
I meant Abs function not Atan, I use Atan to point sprite at mouse cursor.
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 7th Jun 2009 01:21
@Ramus73
I think TheComet was saying to use Paste Image not Paste Sprite. The advantage in using sprites is using sprite collision detection, resizing, and flipping and mirroring. But Sprites eat more processing power than images.

Quote: "Sprites would only paste if I call the sprite first with Sprite n,x,y,i, I then paste it and Hide it, so my next question is does this take more processor time than just having the sprite displayed all the time"

If you want to use sprites and paste sprite, you ae correct, you have to call the sprite at least once to create it, but after that you can keep it permanently hidden. You don't have to show it to paste it. Keeping it hidden is WAAAYYYY less processor consuming than showing it and you can still use collision detection with a hidden sprite. If you don't want it to show at all even when you first create it, create it offscreen -
Sprite spt,-200,-200,img

Then hide it immediately:
Hide Sprite spt

Now whenever you want it to appear and if you want to use collision, position the sprite first, then paste it in the same location:
sprite spt,x,y,img
paste sprite spt,x,y

The sprite is still hidden but you see it's image because you pasted it. The sprite image pasted to the screen is identical to the current state of the sprite, taking into account scaling, flipping and mirroring.

Quote: " I use a atan function to detect how close sprites are to player sprite and only paste sprites when in the visible screen area, does this help the FPS or should I just paste them without checking distances?"

Actually when the sprite is offscreen, it takes less processing power because it isn't being rendered so your onscreen check might be superfluous.

Quote: " Oh and Caleb thnx but I think you will find that Set Sprite n,backsave,transparency is the command"

Actually Caleb was also refering to the Paste Image command which will paste an image - Not a sprite - to the location. Adding a ,1 at the end will allow Paste image to paste with transparency.

Again, if you want to use Sprites, the Set Sprite command you mentioned will save you some processing power as well. If you turn off Sprite transparency and backsaving, your FPS will increase.

Be careful how you are reading the posts because you might be missing out on information you didn't have.

Enjoy your day.
Nizze
16
Years of Service
User Offline
Joined: 12th Jan 2008
Location: Right here - where else?
Posted: 5th Jul 2009 19:23
Quote: "Sprites are ALWAYS in front of everything. You can't change it."

What about DRAW SPRITES FIRST?
Try that; it has worked well for me



Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 6th Jul 2009 01:29
Quote: "DRAW SPRITES FIRST"

lol. that would work, I guess....

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Jul 2009 04:28 Edited at: 6th Jul 2009 04:30
As long as you don't paste images that are over the sprites... like say a background that fills the whole screen... or any 3D object that might obscure the view of the sprite. We generally don't use DRAW SPRITES FIRST for good reason. Of course you'd have to use Pro to have that command.

Login to post a reply

Server time is: 2024-05-20 09:49:20
Your offset time is: 2024-05-20 09:49:20