Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
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 1970 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!