Game Development Community

Jumping with a Z Axis

by John Haley · in Torque Game Builder · 09/03/2006 (5:37 am) · 3 replies

I'm still in the tutorial stage, so I apologize if this is one of those questions that should wait until I'm more experienced with TGB/ToqueScript...

My goal is to make a co-op action RPG that has side-scroller areas (no Z-axis, jump from place to place) as well as areas where you can walk around (Z-axis). So... how would I jump if there's a Z-axis?

My thinking is: when the player jumps, he creates a shadow (or perhaps the shadow always exists, visible or not). The player does not collide with walls; his shadow does. When the player falls on his shadow, cue landing animation, turn off gravity, etc. OK... so that's fine, as long as I'm on flat ground.

As for walls vs. ledges: A verticle collision area is always a wall. A diagonal (horizontal as well, I suppose) wall is a ledge if approached from above, wall if below. I suppose if my "shadow" idea makes any sense, this would mean that if you walk into a collision area, the shadow casts a collision straight down, and if a playable area is found, that's where you land. Does that make any sense? Assuming that idea works, I seem to be all set for ledges too high to jump on, and ledges I can fall off of.

But then, how do I jump up on a small ledge? If when I'm walking or falling, my shadow casts a collision down... and if I'm jumping, my shadow casts a collision up to see if there is a playable area within the height of the player's jump? If so, my shadow moves up, and I land on the platform above. I guess that would work... as long as the collision is only cast when the shadow already collides with the wall.

I'm not a programmer, and I was kinda thinking some of that stuff up as I typed. So, first of all, reality check: does anything I just said make any sense at all? I might have a few flaws in the concept, but if that makes sense, do any of you have experience coding such a thing? I'm very new to the programming world, so any advice would be greatly appreciated!!

About the author

SUMMER PROJECT: Currently working on PSK tutorials. SHORT-TERM GOAL: Make a basic platformer level. LONG-TERM GOAL: Make a co-op platformer in which the two protagonists use their unique abilities to support each other.


#1
09/03/2006 (5:40 am)
Like zelda 3 on SNES? You wouldn't really jump on z-axis but you'd shift layers. So if you are normally on layer 20, when you "jump" you'd be on layer 19 & only the collision on layer 19 would affect you.
#2
09/03/2006 (6:02 am)
I don't remember the jumping in Zelda 3... I do remember you could walk upstairs to the the upper floor and fall to the lower floor. OK, I know what you mean now.

I'm thinking more like Final Fight or Double Dragon. Final Fight had diagonal collision areas, which were walls when you appraoched from "underneath." There was one ledge in the entire game, which you approached from "above." The Double Dragon games on the NES provide a better example. In Double Dragon II, you had side-scroller sections and somewhat-isometric areas. You could fall off ledges and land on another floor, jump on small ledges, climb ladders, fall to your death, and all kinds of stuff that I don't know how to do in a single level. Unless my idea works. Then I just don't know how to code it. Yet.
#3
09/03/2006 (6:08 am)
@Stephen Howe: Still... I should say thanks for mentioning layer-shifting. Good advice if I want the player to walk over a bridge and not get punched by an enemy under the bridge. Or if I want to let the player walk behind a horizontal wall without falling through (since, if my idea actually works, a horizontal collision area with a playable area below would be treated as a ledge).