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.

Newcomers DBPro Corner / Text in front of sprite

Author
Message
TKsFox
18
Years of Service
User Offline
Joined: 25th Nov 2005
Location: No no no - Its not the Cyberspace
Posted: 6th Jan 2006 18:27 Edited at: 6th Jan 2006 19:58
> DBP <

Maybe its a n00b question but this is my code:



I want that the text is shown in front of the sprite which is in front of the black box - (which hides everything behind it)

any ideas how to do that? is it impossible maybe


//edit:

sorry - i typed spritr when i searched the forums - there r at least 2 threads about the same topic:

http://forum.thegamecreators.com/?m=forum_view&t=62873&b=7

//edit2:

Still wont work since i use the d3d dll

It's me...
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Jan 2006 22:59
The easiest way is to "paste sprite" then write the text.


TKsFox
18
Years of Service
User Offline
Joined: 25th Nov 2005
Location: No no no - Its not the Cyberspace
Posted: 7th Jan 2006 14:29
THX alot:



This also fixed sum issues in my game

It's me...
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Jan 2006 15:03
Np.


Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 02:45
mmm i have the same problem, but i cant use paste sprite dunno why.

Grog, or anyone can provide with a coding example of this?

Try using this code, but make the text appear in front of the sprite, w/o using another sprite for it.



thanks
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 11th Jan 2006 03:14
Rather than use 'Sprite' which creates/positions the Sprites in DB & PRO.

You'll need to use "paste sprite" which will render the sprite to the screen there and then. As normally sprites are all drawn during the Sync

So to be careful, once you've paste your sprites, you probably should move this sprite off the screen via 'Sprite 1,-10000,0 " so DB doesn't draw it again over the top of your pasted image during the next SYNC.

Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 05:48
can you post an example code plz??, because i dont know what i do wrong but paste sprite doesnt work for me, i dont know how to set up the sprite 1st w/o using sprite number of sprite,xpos,ypos,image number, but a code using paste sprite and text and stuff will be of great help

thanks
Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 06:04
Ok i got ya now,,,but, heres an example code, im using PASTE SPRITE, but it still doesnt work for me,,

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 11th Jan 2006 06:16
isn't it paste image?

Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 06:21
Theres a way around using another sprite, but i belive most ppl know that...


it would be good to know another way of doing this w/o using sprites, if someone knows how to do it a code will be a lot usefull , thanks
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 11th Jan 2006 06:24
While i don't have DBpro installed, you should be able to do it like this.

Since the SYNC command draws all the sprites, if we set Sprite #1's position way off screen when we create it. ie. Sprite 1,-10000,0,Image (you could prolly use Hide Sprite to do this, you'll have to try it) Then when DBpro draws all the sprites during the SYNC process. It won't draw Spirte #1, back over our text again.

Then we can just Paste Sprite #1 at whatever position we want.





Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 11th Jan 2006 06:26
You can also use DRaw Image (or perhaps it's call Paste Image in DB) to render an image directly to the screen.

A bit like

Draw Image ImageNumber,xpos,ypos

or

Paste IMage imageNumber,Xpos,Ypos

Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 06:30
Yeah, paste image seems to work...


But still,even tho someone that sees the code running could not tell between the sprited box and the imaged box, we are not putting text over a sprite... visually looks the same but the problem persist, and dunno if using paste image is slower than paste sprite..
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 06:31 Edited at: 11th Jan 2006 06:33
@ dabip ______ vgm

You can use either one. If you use "paste image" it will remain the same as when it was loaded. If you use "paste sprite" it pastes what the sprite looks like at the time... as in if you streched the sprite it pastes the streched image, rotated changes, and so on.

@ Rixarn
It looks like it's working. How is it working for you? Can I see a screenshot?

I attached what I see when I run your code. The upper left is the actual sprite and the lower right is the pasted sprite with the text over it.


Attachments

Login to view attachments
Rixarn
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location:
Posted: 11th Jan 2006 06:51
Grog Grueslayer,Perhaphs it´s cuz im using DB pro 5.4??? it was the last uprgrade i installed like a year ago or i dont remember when,,, cuz i left DBpro for a lot of time, i just got back to learning this thing 1 week ago, but perhaphs its a past bug, well thats a good reasong to stop waiting and upgrade it to the last version, what was it 5.8? well, anyways seems im the bugged one, lol,, thanks for posting man
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 06:57
Np. Yeah that's probably why it's not working. Glad to have you back.

The latest is 5.9:
http://darkbasicpro.thegamecreators.com/?f=upgrade_5_9


TKsFox
18
Years of Service
User Offline
Joined: 25th Nov 2005
Location: No no no - Its not the Cyberspace
Posted: 11th Jan 2006 13:40
Just read my code next time

It's me...
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 19:32
Eh? You don't want me to help you again?


TKsFox
18
Years of Service
User Offline
Joined: 25th Nov 2005
Location: No no no - Its not the Cyberspace
Posted: 11th Jan 2006 19:38
No no no...

I ment the fixed one in the 3rd post

It's me...
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 20:17
Ah. Since you use Pro theres one thing you should be doing. Always use ,1 at the end of "get image". ,1 at the end makes Pro grab the image exactly the way it is shown... without making the image blurry.


Login to post a reply

Server time is: 2024-09-24 13:32:07
Your offset time is: 2024-09-24 13:32:07