How to make objects invisible when player goes behind them?

Hello, I was attempting to make an isometric game on GDevelop. But now I stumbled across a problem. Is there any way to make objects invisible when the player goes behind those objects?

For example, if the player goes behind a building sprite (from left right direction, but not from below since the z-order/y-sort works for the depth illusion), then the sprite fades away so the camera focuses on the player?

Is there any way to do this?

Use the player y position, if it’s lower than the object y make the object visibility less.

1 Like

Perhaps you could combine the player’s Y position with a collision box for the object. That would be more specific.

1 Like

Thanks for the reply. I did add a condition like this,

And it worked (well sort of, I guess I need to add some effect instead of just hiding the object)! But is there any way to make the object visible again when the player exits from the area? I tried doing by inverting the condition but it didn’t work.

Thanks for the reply.

I managed to hide the object by adding a condition to Y-position (player vs object). But what do you mean by combining Y position with a collision box? Would you please elaborate?

I added points to the bottom of the player and tree object called base. Below is what I did to get the trees to drop their opacity to 100 when the player is above them and also colliding with them. I also attached the project. If you have any questions let me know.

1 Like

If you’re making a isometric game, have a look at this thread, Keith Hix has written some excellent functions to help with isometric game development


Let’s say your character is walking down a street. There is a house on the far side of the street, behind the character, and another house on this side of the street, obscuring the character. Both houses have collision boxes set.
By combining the character’s Y position with a collision box set to 50% transparency on contact with the character, the house behind him would still be visible, but the house in front of him would be semi-transparent.

1 Like

Thanks a lot. I would try it now.

Thanks a lot. I will check this out.

Thanks a lot for the explanation. Now I understand it.