I've been trying to wrap my head around how to simulate jumping in a 2.5D isometric environment for a while now. So I put together this little prototype with the hopes that the community will be able to build upon this concept and help everyone else learn as well.
I'm hoping there's an easier way to achieve what i'm trying to do here, and I think as a group we can figure it out.DemoCAPX
The idea is basically that when you jump in a 2.5D isometric environment, all you are technically doing is offsetting the players Y position higher than normal from their ground position to appear visually in the air. This works fine if there's no higher platform for them to hop onto. But as you can see its a bit more complicated once that fake 3rd dimension is introduced.
Arrow Keys to Move + Space to Jump (there are no walk/jump animations)
How it works:
The Player Sprite has a Platform Behavior that is pinned to a shadow object which is controlled by 8-Direction movement.
When the jump key is pressed the player sprite is unpinned from the shadow and jumps into the air.
The collision on the shadow is turned off while the player is in the air so that the shadow can travel through the crate object. (when its on the ground its used to collide with the crate to make the prop impassable.
The crate object consists of a front panel, a top panel and a side panel. The front panel sets the height of the box's highest point to set the fake "height" of the crate object.
The top panel is used to determine when the player has collided with the top of the crate and to create a copy of the shadow sprite to follow the player around simulating the appearance that they are walking on top.
The full crate sprite is used to determine how the player collides with it while walking around on the ground, as well as used in the Zsorting for when the player walks behind it.
Once the player has walked off the top panel of the crate, they fall to the ground and re pin to the original shadow once again
Zsorting is achieved by comparing the X/Y position of the player to 3 different image points on the full crate object and setting its order depending on which condition is true.
Things that need improvement:
-Currently you can't jump a second time off the top of the crate.
-There's a few z sorting issues that cause the player to become invisible
-When walking off the top of the crate towards the back, the player stats visible until the hit the ground, (should move to back visually sooner)
-The whole idea is really messy and not easily packaged to be resuable in game in multiple locations.
Any feedback/ideas/tweaks etc welcome.
Thanks for the help!