0 votes

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?

in Engine by (12 points)

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)

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.