Jump King Jumping (variable jump angle/speed based) [Solved]

I’m looking to make a simple Jump King clone where the Player can only move left or right and “Charge” a jump that influences the speed and angle of the jump.

I’ve been banging my head against the wall working with creating a Scene Variable that is a “JumpTimer” that is increased for each moment SpaceBar is pressed. Upon release, the end value of the “JumpTimer” forces a specific Jump Speed. I’ve messed with adding “Add Force (angle)” and that didn’t do much.

I’m very new to this and seemed to have reached a hard wall in my pursuit. Any suggestions of material to read or advice on conditions/actions to use (or extensions).

Thanks!

Hi, here is a quick example for a space-press that increases the jump speed. I have disabled the default platformer-controls.
For increasing the variable ‘jump’ depending on how long the space bar is pressed I use TimeDelta() but you could also use a timer instead (initiate the timer at the beginning of the scene → start it when the space bar is pressed → when the space bar is released use TimerElapsedTime() to set the jump speed and reset the timer).

My ‘jump’-variable is increased by 1000 * TimeDelta() but depending on your needs you can just lower or raise this value.

Awesome! This helps get the variable jumping height for the character. I’ve added a Variable to determine Left or Right movement depending on the last key pressed. Below is a screenshot. I feel like I’m pretty close to the basis of what I’m going for.

The principle things I’m missing are:

  1. How do I disable all controls while Falling or Jumping? (the goal is to take the control away from the player while the sprite is in the air)
  2. How do you set a max limit on the TimeDelta or the Variable:Jump? As it stands now, the value can be prohibitively high if the jump key is pressed for longer than 2 or so seconds.

Thank you!

  1. The only thing I can think of in this situation is to have a boolean variable for the controls (if true the controls work). If the player is falling you can toggle it to false and thus disable the controls.

  2. You can limit the value like so:

Thank you so much, Drona. You’ve been a huge help!

1 Like