# How to fake depth jump on 2D world

Hi,

I’m trying to build a 2d platformer game of character that jump from platform to platform with drag and throw (for mobile devices).

its looks like this:

how can I make a fake depth jump (like fake z-axis) with shadow and the falling also in fake Z direction.

thanks

Looks like could be in “Secretly 3D” game I work on a “2D” game with a similar perspective, in Unity.

Here’s the secret… the game is build a flat 3D plane, with an Orthographic Camera at a 45 degree tilt, and all the objects are on planes that are rotate 45 degrees (unless they’re “flat objects”, in that case their at the same rotation as the ground plane), the sorting of objects is based on Sorting Layers, then “Order in Layer”, and finally the transform position. Upsers

First: I like the graphics, it’s very cute.

Second: I would suggest managing X e Y position inside the code and then apply the position to the character. If it’s already like this it’s easy to manage a fake Z axis.
You just change X and Y with input and store two private variables initialized with 0.0f that is actually the height of the character and the actual phase of the jump (i.e. currentHeight and jumpPhase). Then, when you calculate the position of the character you add this variable (like “height” to the Y position on screen).

The parameter jumpPhase should behave like a parabola, it should be initialized on user’s input and go from 0.0f to N then to 0.0f again.

For the shadow you just need to place a black semi-transparent circle on your collider position that increases in size depending on the parameter: jumpPhase.

Collision should behave exactly like they do now without jumping, so the position of the collider shouldn’t take account of the height. The only difference is that other colliders should have an height parameter that tells you how high they are, and they must be turned off if currentHeight+jumpPhase is greater than its height. If you’re over this object and the calculation I wrote before is true then your currentHeight becomes height, jumpPhase becomes jumpPhase-height.

I also think this is the perfect scenario to fake 2D with a 3D “world”