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 / Nyarg another text/sprite problem

Author
Message
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 18th Jan 2004 01:21
Ok I and my fellow team mates have almost finished a little mini project and I thought it was a good time to dig out my AI code I was working on and do a bit more to it,

Happilly coding away fixing the problems I wouldn't have had a clue how to fix a couple of weeks back.. I realise I have a problem and I haven't got a clue how to fix it..

How do I get text displayed over a sprite without turning the text into a sprite first?

.I've tryed a few different ideas but everytime the sprite is shown over the text after the sync update.

what I need it for is > I have sprites which I would like to be able to tag with an ID numbers so as to keep track of them as they travel around the screen. Obviously it would be a lot easier to text tag each one with text n,x,y than to fiddle about making 20 pluss number sprites...

any help would be great. thx

Ok so its not a mouse.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Jan 2004 05:26
I'm not too sure how to do it, but...

Put Draw To Front at the top of your program, then, make sure the text commands come after any sprite commands, thus, it SHOULD draw the text on last, making it on the top, but, I can't guarentee anything, sorry.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 18th Jan 2004 18:17
No srry tried that allready, the sprites still overlay...

Wierd and confusing I have to say...

Ok so its not a mouse.
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 18th Jan 2004 18:41
paste your image

You can do it if you try
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 18th Jan 2004 19:28 Edited at: 19th Jan 2004 00:38
Um yeah it might work I'll give it a go..

<<edited>>

only one problem now how do I make the bitmap background transparent

its allready 0,0,0 from when I was using it as a sprite.

Or do I use a transparency map form PSP or something?

<<<edited again>>>

also this will also effect sprite collision? how do I get round this using bitmap without using maths collision?



as you can see without it being a sprite there is no transparency mapping...and with it being a sprite there is tagging..unless I off-tag and if I do that with the amount of info going round it isn't easy to keep track.

..low quality jpg better than the bmp it just was..lol

'Ooh 'eck chief'...'crumbs'
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 19th Jan 2004 00:46
maybe I should have posted the pic in a seperate posting just so I didn't have to write this to cause an update..lol

'Ooh 'eck chief'...'crumbs'
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 19th Jan 2004 12:04
What you could do, is in the set up, when you load your images, in the For... Next loop ( assuming you are using that ) Load the image, paste it to the screen, set the current bitmap to 0 ( set it to the screen ) then use the Text command to put the text ontop of the image, then use the get image command, and select the area where the image is, then make that the sprite, and the number is on there permanently.

eg;



Then, when you don't want the text, just rem the appropriate lines!

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 19th Jan 2004 14:30 Edited at: 19th Jan 2004 14:56
um yeah I could try that..
I'm of work at the moment so i could give it a go.

<<EDITED>>

sitting back and looking at it I now have a slightly different problem...

I think I might just lose the numbers completely ...too much of a problem for such a basic program.

If anyone reads this post and knows of a way to overlay text over sprites without turning using paste image instead of sprite then please let me know.. as for now I'm going back to using sprites...

'Ooh 'eck chief'...'crumbs'
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 19th Jan 2004 16:40 Edited at: 19th Jan 2004 16:57
Now I've run into another sprite problem...

the higher number sprite will allways display over the top of the lower number sprite and anything else ..ie text

so I'm now at a stumper again as I was trying to get a lower number sprite to overlay the higher withought changing its number.. (cuz if I did that I would have to start flipping variables with it.. and I would get VERY confused..

Anyone know of a solution to this.?

<<edited>>

and if anyone wants to know why I'm finding this a major problem right now its cuz I'm not using math collision and I'm using sprite collision and db only recognises collision with the top most sprite in a pile...

'Ooh 'eck chief'...'crumbs'
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 20th Jan 2004 06:00
Penfold, that snippet I game you creates sprites with their numbers taged onto them so that you can see them, and you don't have to wory about putting in any more commands to make the text appear.

Also, I doubt you'll be able to fix the problem with the collision being only with the sprite on the top, as that's a built in problem with DB.

If you are using circles for the sprites, and you want to use math collision ( to solve your little problem ) then use the distance equation to determine if two sprites are overlapping or not; ie;



That'll give you your simple math collision and allow you to check collisions without haveing to rely on DB...

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 20th Jan 2004 20:18
yeah I've changed to maths collision now...(see other post.lol)

I didn't really want to have to put the numbers directly on to the pics...there are reasons for this..some of which you'll see when I've finished the code.

also I wanted to change the sprite priority stack to stop a certain problem I was having.. namely a moving sprite travelling over a sprite I wanted onscreen but to be able to be passed over. and I wanted to be able to change the prority of the sprite without changing there order.. mainly as I have other variables linked to the sprite num.

oh well... lol

'Ooh 'eck chief'...'crumbs'
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 22nd Jan 2004 11:31
What you should do is set up an array that has the same amount of dimensions as there are sprites, and set the value of each dimension to the priority of that sprite, ie;



That should help you with that part of your worries.

And the part where I said to put the number on the sprite, if you use that method, it's simple to get rid of it if you want to, just delete the appropriate lines.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Penfold
21
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 22nd Jan 2004 19:52
but I thought you couldn't alter the priority of a sprite in classic?

'Ooh 'eck chief'...'crumbs'
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Jan 2004 04:37
Hmmm...

I can see what your problem is now...

I am not too sure how you would go about fixing that, except for creating the sprites in the exact order that you want their peiorities to be. If you know what I mean...

Sorry,
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-22 16:56:52
Your offset time is: 2025-05-22 16:56:52