[SOLVED] How can I get a Gui and Mouse graphic to be behind an object?

Started by Fedx, Sun 03/05/2020 23:17:48

Previous topic - Next topic

Fedx

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!
- The gamer doesn't dies... he respawns -

Lewis

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.
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

Cassiebsg

Fedx, just place your sky object in a sky GUI instead, then make sure the z order is in front of the flashlight.  ;)
There are those who believe that life here began out there...

Fedx

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!
- The gamer doesn't dies... he respawns -

Lewis

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:
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

SMF spam blocked by CleanTalk