2.5D Jumping proof on concept - need help

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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.

    Demo

    CAPX

    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!

  • Looks very nice! I noticed you can continue jumping while still in air, but that's an easy enough fix. Good job!

  • bump

  • That example is almost there really. Seems like a bit of a hacky way to do it though.

    I did used to know how to do this kind of system in a more elegant mathsy way but i'm a bit sketchy on it now.

    I will probably try making a game with it at some point. I'll definitely see if I can put together a neater solution, although i'm sure someone using Construct 2 must have done it before, its not like its a brand new concept noones tried before.

  • I'm going to try and remake it with the new z order plugin and see if that helps a bit.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have been thinking on this for a while. Steam refuses to get the latest beta build of Construct 2 so I can't test the new Z-order, but the way I have thought about solving the problem is to separate the Y value into Depth and Height which, when added together, give the onscreen Y position (D + H = Y).

    The 8/4-Direction controller would just effect the X and D values, whilst pressing jump will only effect the H value.

    You could then test for collisions by checking height values when sprites overlap. If the height value is significantly different, then they do not collide, even if their onscreen Y is the same.

    Conversely, if you wanted to get the depth of a tile that is raised or lowered in relation to another tile, you could just perform Y - H = D.

    You would just need a heightmap for your scenery for reference.

    I haven't tested any of this yet, but these are my ideas.

  • OK.. i think i've done it.. in like pretty much just a couple of events as well.. surprised myself there. I should be sleeping but need to upload this.

    Update:

    Isometric Z-order

    Example on Scirra Arcade now. There is a major problem running it in Chrome atm, it doesnt like the way I Z-ordered some things. It works perfectly in Firefox and IE10. I'll fix it to work in Chrome then upload capx.

  • Awesome work Tommyttk I look forward to checking out that capx. Thanks for your help with this!

  • I was able to fix the Chrome problem and the capx is available now.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)