diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-02-05 22:03:03 +0000 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-02-05 22:03:03 +0000 |
commit | 3acc9bee54ec9c96403b0b4a54983c4ad76530dc (patch) | |
tree | f5440c4b797c25fc3cd962efcfd20ed66d93a47d /scripts | |
parent | 07b76592d9e79c4e319bbc3c593ed5f2731b3b12 (diff) |
Adjust climbing so stamina only lost while moving
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/player.gd | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/player.gd b/scripts/player.gd index f0886ef..73490d3 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -108,7 +108,6 @@ func _physics_process(delta): if valid_climb and stamina > 0: last_wall_direction = get_wall_normal() climbing = true - stam_consumption += RUN_CONSUMPTION elif climbing: climbing = false @@ -126,11 +125,13 @@ func _physics_process(delta): # As good practice, you should replace UI actions with custom gameplay actions. var input_dir = Input.get_vector("left", "right", "backward", "forward") var direction = (input_dir.y * fwd + input_dir.x * right).normalized() - var climb_direction = (input_dir.y * climb_direction_fwd + input_dir.x * climb_direction_right).normalized() + var climb_direction: Vector3 = (input_dir.y * climb_direction_fwd + input_dir.x * climb_direction_right).normalized() if climbing: #print("Climb direction is ", climb_direction_fwd, " ", climb_direction_right, " ", get_wall_normal()) velocity = climb_direction * speed velocity += -speed * last_wall_direction + if input_dir.length_squared() > 0: + stam_consumption += RUN_CONSUMPTION #print("Velocity is ", velocity) elif direction: velocity.x = direction.x * speed |