Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | SomieStuff |
Hi, I’m new to gdscript, and I’m starting with making a simple 2D platformer. I’m trying to make it so if you make a specific input, you can time your jump 2 more times to get a bigger jump (like “Donkey Kong 94” if you’ve ever heard of that)
First, I made a timer in the characters physics process, so I could track how many frames since the player landed, this works with no errors
if is_on_floor():
jumpTimer = jumpTimer + 1
else:
jumpTimer = 0
After that, I made some if statements for the first two jumps, which work really well, and the timing works nicely.
if Input.is_action_just_pressed("Jump") and is_on_floor() and Input.is_action_pressed("Down"):
tripleJumpState = 1
print(tripleJumpState)
if Input.is_action_just_released("Jump") and tripleJumpState == 1:
tripleJumpState = 2
if Input.is_action_just_pressed("Jump") and is_on_floor() and tripleJumpState == 2 and jumpTimer < 15:
jumpForce = jumpForce2
Now I tried to do this again with a third jump. But now the second jump will go just as high as the 3rd jump
if Input.is_action_just_released("Jump") and tripleJumpState == 2:
tripleJumpState = 3
if Input.is_action_just_pressed("Jump") and is_on_floor() and tripleJumpState == 3 and jumpTimer < 16:
jumpForce = jumpForce3
Any idea how to fix this would be really apprieciated