From 1a63eb2a9b4b50ca925f87a026b48ca0a782a9de Mon Sep 17 00:00:00 2001 From: karl Date: Sun, 24 Nov 2019 22:21:26 +0100 Subject: [PATCH] Fix some weird stuff in the sprinting code --- WikiJam/Level/Fortaleza.tscn | 1 + WikiJam/Player/Player.gd | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/WikiJam/Level/Fortaleza.tscn b/WikiJam/Level/Fortaleza.tscn index 7b5f63b..154b2ac 100644 --- a/WikiJam/Level/Fortaleza.tscn +++ b/WikiJam/Level/Fortaleza.tscn @@ -66,6 +66,7 @@ transform = Transform( 0.573576, 0, -0.819152, 0, 1, 0, 0.819152, 0, 0.573576, 1 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 45, 0, 48 ) [node name="Walls" type="Spatial" parent="Navigation/NavigationMeshInstance"] +editor/display_folded = true [node name="Wall3" parent="Navigation/NavigationMeshInstance/Walls" instance=ExtResource( 3 )] transform = Transform( 0.766044, 0, -0.642788, 0, 1, 0, 0.642788, 0, 0.766044, 38, 0, 22 ) diff --git a/WikiJam/Player/Player.gd b/WikiJam/Player/Player.gd index 6fc2bf2..c864689 100644 --- a/WikiJam/Player/Player.gd +++ b/WikiJam/Player/Player.gd @@ -17,8 +17,8 @@ const MAX_SLOPE_ANGLE = 40 const MOUSE_SENSITIVITY = 0.05 const MAX_MOUSE_SPEED = 25 const INTERACT_DISTANCE = 4 -const SPRINT_DEC = 0.01; -const SPRINT_ACC = 0.005; +const SPRINT_DEC = 40 +const SPRINT_ACC = 20 # private members var _body: Spatial @@ -68,9 +68,9 @@ func _physics_process(delta): func _process(delta): _process_animations() if _is_sprinting and _sprintVal > 0: - _sprintVal -= SPRINT_DEC / delta + _sprintVal -= SPRINT_DEC * delta elif _sprintVal < 100: - _sprintVal += SPRINT_ACC / delta + _sprintVal += SPRINT_ACC * delta func _process_input(): @@ -111,7 +111,7 @@ func _process_input(): _vel.y = JUMP_SPEED # sprinting - _is_sprinting = Input.is_action_pressed("move_sprint") and _sprintVal > SPRINT_DEC + _is_sprinting = Input.is_action_pressed("move_sprint") and _sprintVal > 0 func _process_movement(delta):