• 2D
  • Handling jump and physical height in a top-down 2D game

Greetings devs. It's been more than week now, I still couldn't find a proper solution to make a 2.5D game in the style of CrossCode. My biggest issue is the physics behind collisions and movements. How do you make a 2d character jump with a "physical" height ? How to make him stand on top of an upper ground, say ontop of platforms with physical height themselves ? How to make him fall in a pit and handle Ysort efficiently in alike situations ? I have no answer to these and need your help. The ideal result would like this once the problem is handled :

15 days later

Think about the game as not being really 2D. Your character can move on a third axis and so your physics system needs to know about this. You just render it as two dimensional. When your character jumps, you render him above his standing position. So you only move him on the y axis of the screen. But in the gameworld, the character didn't move on the y axis of the screen, but on the worlds up axis. It depends on the game you are making. Maybe it is just enough to have two ore more layers where your character is on. If he jumps, you blend him between those layers. So with that, you would just have some more layers of your world with objects on it. Then you could use the built in physics to get things working. Does this help you? Otherwise, please be a bit more concrete with your question. So it is easier to know where your problems are.

edit: After checking the video, is it just about the rendering? What is your current attempt? Normally you would use different z indices. I think that is what you are doing right now. Different layers have different z values and the more a tile is in the foreground, the higher it z value should be. So your character can stand behind objects on the same layer.

7 months later

@Schorsch Hey. It's been months now. But sadly, I still haven't found a proper way to handle the problem. But I have the feeling I wasn't too concrete/explicit. The design I want to go for is first for the graphics, a 2D topdown system that considers z axis as y. So a rendered Sprite is higher or lower on the y axis depending on both it's y and z coordinates. Using a third coordinate is compulsory for this. Implicitly, I have to take care of tilemap data as well, and add them a height to compute the rendering . Now the part which is so skeptical to me is the collision part. Supposing I wanted pixel perfect collision with either pixel pyramids, pixel cylinders or even slopes, aside from the regular cubes and prisms, I don't know where to start. I have however an hypothesis I need to verify. I must first take care of the collision problem in side view with a simple platformer project. Then, maybe from there, I would find the logic needed to replicate the behaviours but in a topdown view this time. Anyway, if you have any helpful resources, don't hesitate to post them in your comment. Thanks for taking the time to answer me.

Hey NewBro00

This looks great! this concept is way too complicated for me, but in the spirit of the forum i.e. helping people

I would personally take the 3D route and cheat it like this https://youtube.com/watch?v=xwJ7nrHyoEE

or if you are set on the route you are on, this video has the concepts explained nicely. It's with a different engine but more than do able in Godot. https://youtube.com/watch?v=xwJ7nrHyoEE

hope it helps, sorry if I have misunderstood.

Good luck