Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (854)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Variable Height Jumping  (Read 3558 times)
0 Members and 1 Guest are viewing this topic.
Offline UprightPath
« Posted 2012-02-22 10:03:02 »

I'm working on a platformer (Really thanks to SkyAphid's question earlier about randomly generated Platform dungeons xD), and I'm currently working on player control/physics. While enemies will be able to "select" their jumping velocity (Within some bounds), I'm having trouble deciding how I want to do this for the player.

Basically the plan is to make it so that the player can have their character jump a "variable" height, depending on how long they keep the jump key pressed down. Meaning, they can 'tap' for a little jump. Press-and-hold for a larger one. Perhaps even having something like a Press-and-hold until you reach the height you wanted (Within the jump-height limit).

The main issue that I'm having here is that all of these options mess up the idea of the parabolic arch that a jumping character should follow (Not to mention the whole "I can still move left and right while falling" thing a lot of games are based one). Starting from the 'tap', the character will be given an upward velocity, which is then acted on by gravity to bring them back down. For the other options, it causes an odd skewing of the arch due to not having the "right" initial velocity and having to correct it for each logic step where the jump key is still pressed down.

I was wondering if anyone has some advice on this issue, whether it's just bite the bullet and eat the odd parabolic arch or some insight on how it's been done in other games.

Offline lhkbob

JGO Knight

Medals: 32

« Reply #1 - Posted 2012-02-22 15:41:50 »

You could have double-jumping, which is pretty common.  A 2nd tap while in mid air just has them jump again.

Alternatively you could have something where jump height is based on the speed the character is running.

Offline UprightPath
« Reply #2 - Posted 2012-02-22 15:49:58 »

Both of which I was actually considering (Though, the 'current speed' was more of a horizontal jump distance thing for me).

I should say that double-jump is something I'm planning on adding, though it's going to only be available after some flag is set (Not sure what will enable it yet, I'm sort of torn between different ideas there, but those are outside this discussion.)

The idea of the speed affecting jump is interesting. I'm already making the PC's movement be controlled by a FSM (Partially affected by the input from the player, partially affected by surrounding), where Walking and Running on going to be states. I was thinking of leaving the two with the same 'Vertical Jump' velocity, but give them different horizontal movement components (Such that a running person will jump farther than a walking person, just because their velocity there is bigger).

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline huckanator2.0

Innocent Bystander

« Reply #3 - Posted 2012-02-23 20:25:02 »

So the it seems as though the issue here is that you need to have the jump height decided at the time that they start jumping(e.g. so you don't have a non-parabolic jump trajectory).I see a couple of options:

1: the player holds down the jump key prior to jumping; jumping when the the key is no longer pressed. However this creates the situation where the player might spend lots of time holding down the key (e.g. priming themselves for the next jump).

2: Have a second key for jumping higher. 
Offline lhkbob

JGO Knight

Medals: 32

« Reply #4 - Posted 2012-02-23 21:07:18 »

I think huckanator's #1 is reasonable, especially if it's accompanied with animations showing the person crouching lower to get a better jump.

Regarding horizontal jumps, I think there's nothing stopping you from having speed increase both the height and distance.  You could have the horizontal distance increased more, so you still get the stretched out curve you'd expect, but it might also let the player jump 1/2 a unit or block higher.

In my thinking, I always imagined the character had acceleration, akin to Sonic or others, where the more they'd move forward the faster they went, so jumping high distances would require a careful preparation.  Obviously, this might not work for your mechanics.

Offline UprightPath
« Reply #5 - Posted 2012-02-23 21:19:37 »

I was toying with the idea there, Huckanator.

Boy of them, honestly. Though, the "jump priming" would have a higher end. Probably a sliding scale of several different trajectories. Like having a 'tap' jump, a 'press and release' jump, and a 'press, hold, release' jump. Or, perhaps just a filling the jump scale sort of thing.

As for the running resulting higher vertical leap? Perhaps a little, but to me it seems like it's more of a Long Jump style thing. Because it's very difficult to convert horizontal velocity into vertical velocity without some sort of ramp (And even then) or something to cause rotational friction.

I am implementing an incremental velocity change system for movement. Walking starts out slow, but gets faster to a certain cap. Running increases the cap and the acceleration. Jump distance only really comes into this in that the leap gives a bit of vertical velocity (More like the 'tap' mentioned earlier). So the faster you're running, the further you jump.

Pages: [1]
  ignore  |  Print  

EgonOlsen (1241 views)
2018-06-10 19:43:48

EgonOlsen (1110 views)
2018-06-10 19:43:44

EgonOlsen (850 views)
2018-06-10 19:43:20

DesertCoockie (1260 views)
2018-05-13 18:23:11

nelsongames (1101 views)
2018-04-24 18:15:36

nelsongames (1330 views)
2018-04-24 18:14:32

ivj94 (2069 views)
2018-03-24 14:47:39

ivj94 (1224 views)
2018-03-24 14:46:31

ivj94 (2156 views)
2018-03-24 14:43:53

Solater (788 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!