2D Fake Depth Jump

Hello, and thanks to everyone who will read this.

I’m actually trying to recreate a game from my childhood which is in 2D and is based on sprites.

The point of the game is to fight players/bots and be the last person alive (to summarize)

Here is what the game looks like. (The Game is called “Little Fighter 2”)

I’m at the point where I am trying to implement the jump skill.
But because the game is made only of 2D sprites, we can only move along the x or y axis.

Unfortunately, every terrain is made of “walkable areas” that are just lines that the character can not cross.

For example, for this terrain, the red lines are the walkable area :

I implented these “walkable areas” by adding multiple tiny BoxColliders 2D and it works (but I don’t know if that’s the best method to do it tho).

However, when it comes the the jump skill, i’m facing the problem of these “walkable areas” because the jump that I added is based on the y position of the character and it looks like I can’t use build-in gravity because there is no real colliders on the terrain. It’s obviously not the good method to do, so i searched on the forum and on the Internet how to fake depth jump, but I can’t find a suitable solution.

What my scene looks like :

My ideas were :

  • Rotate every single sprites on the screen to 45° to get some sort of depth, but with this, I don’t know how to make my colliders works together (gravity? no gravity…?)

  • When my character jump, i enable the gravity, make it jumps towards the z-axis to get passed these walkable areas with some sort of raycasting at his base to locate if he touches the ground then disable the gravity again

  • Use sorting orders

Sorry for the long post, I hope I am clear.

Thanks.

Sounds to me like you should just do the gravity calc’s yourself. A jump isn’t a terribly hard calc, you just have an initial velocity up which decreases by a set acceleration till it becomes negative. You can even cheat the ground check a bit since you’ll know that your final negative velocity will be equal to the starting positive velocity. You also don’t need to be super precise so you can fudge rounding and such fairly easily without the player noticing.