Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Fedx on Sun 03/05/2020 23:17:48

Title: [SOLVED] How can I get a Gui and Mouse graphic to be behind an object?
Post by: Fedx on Sun 03/05/2020 23:17:48
First of all, I'm sorry for my english, if there's something that doesn't make sense about my explanation, please let me know!

I have a room that's a backyard, that is almost completely dark, and you can see the moon and the night sky, like here: https://imgur.com/1UqHoiq

The character has a flashlight that he can turn on and off, transforming the mouse graphic from normal to this one: https://imgur.com/XwzKJBV and changing the background to this one: https://imgur.com/Uriv3Ls
Also, a Gui which is a black rectangle with a hole in the middle is now visible, with a transparency of 10 to still have some darkness. The thing is that this Gui also affects the sky, something that in real life shouldn't happen, so it looks weird like this https://imgur.com/fIc6JPw.

I tried making an object that's just the sky and adjusting the baseline, but the Guis baseline only interacts with other Guis, and still, there's the problem of the mouse graphic. What I'm trying to do is make it look like this: https://imgur.com/zt6AvzR

Thanks a lot!
Title: Re: How can I get a Gui and Mouse graphic to be behind an object?
Post by: Lewis on Mon 04/05/2020 06:29:58
This might not be the best way but I'd do it slightly differently.

To avoid the GUI/mouse pointer issue, I'd make the mouse pointer invisible for that scene and combine the flashlight effect and black screen into one large object twice your game resolution. In the middle of your object sprite is the flashlight effect with transparency, which then turns to solid black as required.

I would then make the object follow my mouse pointer in repeatedly_execute_always by constantly setting the object coordinates to be commensurate to the mouse coordinates, with x and y offset according to the object size and your game resolution.

You could then make the sky another object and set this to be in front of your flashlight/darkness object.

I'm sure there is a cheaper and more technical way, but that's the inelegant solution I'd land on in your position.
Title: Re: How can I get a Gui and Mouse graphic to be behind an object?
Post by: Cassiebsg on Mon 04/05/2020 16:02:22
Fedx, just place your sky object in a sky GUI instead, then make sure the z order is in front of the flashlight.  ;)
Title: Re: How can I get a Gui and Mouse graphic to be behind an object?
Post by: Fedx on Mon 04/05/2020 17:19:50
Quote from: Cassiebsg on Mon 04/05/2020 16:02:22
Fedx, just place your sky object in a sky GUI instead, then make sure the z order is in front of the flashlight.  ;)

Oh my god why didn't I think of that first!! Thanks a ton Cassie, it worked like a charm!
Title: Re: [SOLVED] How can I get a Gui and Mouse graphic to be behind an object?
Post by: Lewis on Mon 04/05/2020 18:45:43
Quote from: Cassiebsg on Mon 04/05/2020 16:02:22
Fedx, just place your sky object in a sky GUI instead, then make sure the z order is in front of the flashlight.  ;)

That is... much less convoluted than my method.  :grin: