diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-11-21 09:15:09 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-11-21 09:15:09 +0200 |
| commit | a2ed86861122d25f0d4fe1ce7a8ec31429a134b2 (patch) | |
| tree | e9237ec2ced957fba3668f170e4d45e9c913e88c /player.gd | |
| parent | 74494315303723b6cdac5198d9fc90f334ced778 (diff) | |
Add test room 3
Diffstat (limited to 'player.gd')
| -rw-r--r-- | player.gd | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -50,6 +50,8 @@ func _physics_process(delta: float): #print_debug("1.0 + (", velocity.y, " / (", jump_held_coef, " * ", jump_strength, ")) = ", grav_coef) velocity.y += grav_coef * gravity * delta + if velocity.y > jump_strength: + velocity.y = jump_strength if is_on_floor(): coyote = 0 @@ -67,7 +69,7 @@ func _physics_process(delta: float): jump_was_released = true var direction: float - if forced_input_x: + if forced_input_x != null: direction = forced_input_x elif Input.is_action_pressed("move_left") and Input.is_action_pressed("move_right"): # This is a fix to the stalled movement issue @@ -85,21 +87,23 @@ func _physics_process(delta: float): ## dir: String or null func set_forced_input(dir: Variant): + var jump_coef = 1.3 if dir == null: forced_input_x = null elif dir == "LEFT": forced_input_x = -1.0 elif dir == "JUMP_LEFT": - velocity.y = -jump_strength + velocity.y = -jump_coef * jump_strength forced_input_x = -1.0 elif dir == "RIGHT": forced_input_x = 1.0 elif dir == "JUMP_RIGHT": - velocity.y = -jump_strength + velocity.y = -jump_coef * jump_strength forced_input_x = 1.0 elif dir == "JUMP": velocity.y = -jump_strength forced_input_x = 0.0 + gravity = 0.0 elif dir == "DROP": velocity.y = 0.0 forced_input_x = 0.0 |
