Product Chat / Getting text behind the sprite

Author
Message
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Jun 2016 07:28
Hi guys
And I want it in front of the sprite, since I can see the text hidden, behind the sprite.

Any chance to get it over the sprite?

code



Thanks in advance 4 all feedbacks

3com

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Jun 2016 08:18
I've tried this code too, with the same result; text appears behind the sprite.



Quote: "PasteSprite: PasteSprite ( mySprite ) -- pastes the sprite at its current location (good for pasting sprite BEHIND text)"


What I'm doing bad ?

3com

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 4th Jun 2016 09:00 Edited at: 4th Jun 2016 10:03
at first glance, you need to use Loc_Sprite instead of imgLoc for the PasteSprite command i.e. PasteSprite (Loc_Sprite) as that's the variable your assigning when you create the sprite .
Also (as a suggestion), maybe create the text as a sprite and then overlay the text sprite onto your "Loc_Sprite". Example code below only creates the sprite once in the _init section. Make sure your image has transparent background.

Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen). Wanting a new PC at some point.
Interests: Drumming, Saxophone, Art, Theatre, Music.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Jun 2016 09:49 Edited at: 4th Jun 2016 09:51
Paste sprite requires the x and y position, so you can remove the setspritedepth and change setspriteposition to move the sprite off screen , just using pastesprite(ID,x,y) will work to put the sprite on screen and allow text in front of it.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 4th Jun 2016 10:28 Edited at: 4th Jun 2016 10:59
PasteSprite doesn't use x,y , but PasteSpritePosition does and this now works.

Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen). Wanting a new PC at some point.
Interests: Drumming, Saxophone, Art, Theatre, Music.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Jun 2016 12:12 Edited at: 4th Jun 2016 12:12
Thanks guys.

@ BOTR
You are right, pastesprite does not use x,y, but "PasteSpritePosition".
It works now ! thanks very much 4 the useful tip.

I was getting 2 sprites when using "PasteSpritePosition", do not mind to hide one.

Sprites need X,Y and text need depth.

TextCenterOnX(50,50,3,"Location successfully entered",1) -- 1 meant text on top.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Jun 2016 18:09
I did it the hard way in Alien Invasion and used my own sprites for everything It suits it better in the end that way anyway, as I deliberately had the graphics low res to look more retro. Regarding this though, I would have much preferred a depth feature to the text rather than an new sprite command entirely. Perhaps there's a technical reason why it was done this way, but I'm used to text working with either method in other languages.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.

Login to post a reply

Server time is: 2024-05-17 20:31:28
Your offset time is: 2024-05-17 20:31:28