Fix some weird stuff in the sprinting code
This commit is contained in:
parent
51325fb5ef
commit
1a63eb2a9b
@ -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 )
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user