Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: adenak on Sat 19/10/2024 21:17:56

Title: object hidden in other object.
Post by: adenak on Sat 19/10/2024 21:17:56
hi! First of all i RTFM, but no luck at all.
I just need to hide an object let's say in a box.
The box is an object and whe i click on it's opening, revealing the other object to collect.

Since there's not z-index. how can i do something like that?
the objects are not overlapping, the hotspot are not working over objects.
What a i missing here?
Thanks so much.
Title: Re: object hidden in other object.
Post by: Snarky on Sat 19/10/2024 21:33:54
Object Z-order is governed by their baselines, which by default is their y-coordinate. The heuristic is that things with a baseline further down on screen are closer.

That rule works pretty well most of the time, but when it doesn't you can override the Object.Baseline for the objects in question.

But I'm not sure this really addresses your issue, since you say the objects are "not overlapping." Are you simply asking how to hide an object and then display it? If so, you should set Object.Visible to false/true.
Title: Re: object hidden in other object.
Post by: adenak on Sat 19/10/2024 21:58:01
ok, thanks for the answer!
Let's say i have an armchair and some stuff in it.
I make an object oArm and i import 2 sprites: one if it's closed and the other for the open one.
when i click on the oArm the sprite is loaded and i see the sprite "open".
Now inside the armchair i got a pair of shoes. I need to take the shoes.
That'it, i'm stuck here. How can i make the shoes appear over the OArm object?
object over another seems not possible, so i tried painting the shoes on the arm sprite open and then using hotspot but hotspots are not drawable over object.
The only way is maybe to use the background to change... but seems not good...
Thanks again.
Title: Re: object hidden in other object.
Post by: Crimson Wizard on Sat 19/10/2024 22:43:00
As Snarky have mentioned above: you need to manually set object's Baseline property.
Either do this in the Object's properties in the room editor (set BaselineOverridden first), or in script using a script command:
https://adventuregamestudio.github.io/ags-manual/Object.html#objectbaseline

Title: Re: object hidden in other object.
Post by: adenak on Sat 19/10/2024 23:08:23
Done! thank you people!