|Topic was automatically imported from the old Question2Answer platform.
Say there is a tileset for making cliffs. The player can stand on top of the platforms of these cliffs, like so:
However, the player should also be able to walk behind the cliff, like so:
The problem is, that the collision of the tileset will prevent the player from entering the area behind the cliff. I spent several weeks searching for the solution and couldn’t find any, how does one solve this problem?
(Sorry if the images don’t show up, this is my first time trying to post them here, so it might not work)
I’ll try to provide more specific information if necessary.
I haven’t tested this myself, but check these similar questions:
player.z_index > cliff.z_index: (Player will be drawn in front of (on top of) the cliff)
I suppose what you can do is put an
Area2D node behind the cliff, and when the player enters it, his
z_index is lowered so that he can walk behind (under) the cliff.
player.z_index should be higher than
cliff.z_index, so that he can walk on/up it.
You could also use a
YSort node, as mentioned in those posts.