How to create a top down depth system

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By everuniverse

I have different ideas of how to implement a depth system in a 2D top down (platformer) game, still experimenting and figuring out elegant solutions.
First I programmed a KinematicBody2D to have a z-axis and the ability to jump. Next I want to create an obstacle to jump on, climb, fall off, hide behind etc.

Are there any design patterns and best practices in general already and also solutions regarding implementation in the Godot engine?

You could clamp the z_index to the platform the character is stood on.

player.z_index = clamp(player.z_index, platform_height, maximum_height_allowed)

Magso | 2020-09-30 13:46