2.5D Jumping proof on concept - need help

Get help using Construct 2

Post » Thu Jan 17, 2013 9:11 am

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!
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Jan 18, 2013 1:00 pm

Looks very nice! I noticed you can continue jumping while still in air, but that's an easy enough fix. Good job!
B
7
G
1
Posts: 27
Reputation: 991

Post » Tue Feb 26, 2013 7:48 pm

bump
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Wed Feb 27, 2013 10:35 pm

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.
B
14
S
4
G
3
Posts: 38
Reputation: 3,741

Post » Wed Feb 27, 2013 11:12 pm

I'm going to try and remake it with the new z order plugin and see if that helps a bit.
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Thu Feb 28, 2013 12:11 am

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. Cereal Killa2013-02-28 00:14:35
B
11
S
2
G
3
Posts: 22
Reputation: 2,595

Post » Thu Feb 28, 2013 1:23 am

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.Tommyttk2013-02-28 13:28:14
B
14
S
4
G
3
Posts: 38
Reputation: 3,741

Post » Thu Feb 28, 2013 3:05 pm

Awesome work @Tommyttk I look forward to checking out that capx. Thanks for your help with this!
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Thu Feb 28, 2013 3:32 pm

I was able to fix the Chrome problem and the capx is available now.
B
14
S
4
G
3
Posts: 38
Reputation: 3,741


Return to How do I....?

Who is online

Users browsing this forum: Ahr Ech, Baidu [Spider], benajad, Braus, R0J0hound, shinkan and 19 guests