0 votes

For this top down game, and I want the player to be able to place rooms wherever they want, and however big they want. The NinePatchRect node seems perfect for this, since I can resize textures and they retain their quality, but obviously NinePatch is a Control node, so I can't change its z index.
The problem is, I need the player to be able to go behind the wall. I currently set the player's z index as their y position every frame. All the NinePatchRects are stuck at a z index of 0, so my player is always above them. Any idea on how I can make this work?

My setup.
My setup.

Ingame
In-game. The player is supposed to be hidden behind the wall.

in Engine by (85 points)

1 Answer

+3 votes
Best answer

I actually solved it myself! If you make the control node a child of a 2D node, and alter the 2D node's z index, the control node will also have it.

by (85 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.