Scripts / Getting a sprites boundaries

Author
Message
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 8th Jul 2017 18:19
Hi all,
I was wondering if there was a command that will return a sprite boundaries?

Currently I am manually working out the left x, right x, top y and bottom y boundaries of a sprite, and as you can imagine, if there are lots of sprites at once, it can get incredibly tedious. Just wondering if anyone knows an easier way of finding out this information?

Cheers!
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Jul 2017 19:57
Not sure what you mean as the sprite goes wherever you tell it to go.

For example if you size a sprite as 10 and place it at 40,40 then the top and right boundary will be 50.

Of course if you don't specify a size then the boundaries will change depending on the screen dimensions.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Jul 2017 20:10
there's no way by default but as amen said it's % based so if you assign a size when you start then you can store it in an array and use it later from that.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 9th Jul 2017 06:13 Edited at: 9th Jul 2017 17:10
was going to say since its all relative by % of the screen there isn't any way from what I know, of how to reference anything by pixels in this manner. I could be wrong.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Jul 2017 09:20
You can return the current screen resolution though so as long as you know the % size set for each sprite you can work out how many pixels it is - though there isn't really any point if you just work in %.

If I'm unsure how big I want everything to be I'll just put it into paint program and set the canvas to my ideal resolution, then work out the % of the canvas each sprite should be from there.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-04-19 21:36:33
Your offset time is: 2024-04-19 21:36:33