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 sprite problem

Author
Message
ArcAngel
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 10th Jul 2005 07:02
I'm having a problem putting text over my sprites. Here's my code.



I have a feeling it has to do with sync. I heard that sometime DB Pro needs double sync commands... something about double buffering.

"It is well that war is so terrible, or we should grow too fond of it."
"Visit my website! www.freewebs.com/stradigos"
pizzaman
21
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 10th Jul 2005 08:05
Here are a few ways of putting text over a sprite:

1. Hide the sprite, use paste sprite to display the sprite then display the text over it. With this method you can still check for sprite collisions.

2. Make the text you want to use as an image then make it a sprite with higher priority (or you could make every letter an individual sprite). This is a messy approach however it does allow a great deal of flexibility for you text.

3. Use the command "draw sprites first", everything will be drawn over the sprites. However if you have 3D objects in view I think these are also draw in front of the sprites - might cause a problem.

Also this has nothing to do with sync. You are right in that DBP uses double buffering to draw to the screen. This means the first sync of the program will appear to do nothing, however its filling the first buffer. Another sync will cause the first buffer's contents to be moved to the second buffer and the first buffer to be filled again. Due to both buffers being full the screen can be updated.

Zergei
20
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 10th Jul 2005 13:35
Question: Does a sprite and text have a "z" coordinate?
Eddie B
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 10th Jul 2005 21:05
Perokreco
20
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Bosnia and Herzegovina
Posted: 11th Jul 2005 06:40
But sprites have sprite priority
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 11th Jul 2005 10:21
I have a similiar problem. I tried ArcAngels approach by looking at his code. Got the same problem as he did. Since I'm having 2D and 3D I can't use the draw sprites first command like suggested. I then made a bitmap with the text already on it and made it into a sprite. The only problem with that is that the text came our really really bad no matter how good it looked on the bitmap. It looked mosiac and was missing limbs of letters. For example an h looked like a n. It was pretty bad. I'm not sure how you can do number 1. Pizzaman can you explain the process that goes along with option number 1? Also, can someone explain why my sprites are having problem with text?
pizzaman
21
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 13th Jul 2005 01:52 Edited at: 13th Jul 2005 10:11
When you turned you font into a bitmap did you remember to use load image with the extra flag, for example

load image "Image Name.bmp", ImageNum, 1

This could be a reason why it didn't turn out right. Also if you used an animated sprite there is currently a bug with it which displays images a little funny (version 5.8).

Anyways to do option number 1, this is how you do it.
1. Set up your program as normal
2. Hide all your sprites.
3. Use paste image with the correct image and coordinates to draw the sprites images.
4. Use the text command to draw text to the screen.

Heres an example program that demostrates this



There is one thing I forgot to mention, if using this method your sprites cannot be rotated or scaled as your images won't reflect the sprites images. In this situation option 2 would be the best.

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 28th Jul 2005 11:46
Quote: "Does a sprite and text have a "z" coordinate?"


Sure do

Set Sprite Priority changes this, and lets you "Z"-Order your sprites on the screen.

I like to think of sprites as a 2D plane in an Orthagonal view-port.
( In Orthagonal, no matter at what angle the plane is, it will always be "flat" on the screen ).

That way, you can visualize "Z"-Ordering your planes

Easy stuff.

Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
poisoned
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location: the shadow realm
Posted: 29th Jul 2005 02:58 Edited at: 29th Jul 2005 03:03
If all you want is to place text over some sprites just use the command:





Im sure this is not the only way of doing it but it works.

Intel P4 3.6Ghz 1G PC3200 DDR

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-05-17 14:15:17
Your offset time is: 2025-05-17 14:15:17