@export var dash_length := 10.0
@export var air_speed := 3.0
-@export var acceleration := 50.0
+@export var acceleration := 30.0
@export var rotation_speed := 10.0
@export var idle_timeout := 5.0
-@export var hard_landing_limit := 10.0
-
-@export_group("Physics")
-@export var push_force := 5.0
@export_group("Camera")
@export_range(1.0, 10.0) var camera_distance := 2.0
var _floor_normal := Vector3.ONE
var _ground_slope_input := 0.0
var _camera_input_direction := Vector2.ZERO
-
-enum {CAMERA_MOUSE_INPUT, CAMERA_JOYSTICK_INPUT}
-var _camera_input_method := CAMERA_MOUSE_INPUT
-
var _idle_time: float = 0.0
var _player_speed: float = walk_speed
+enum CameraInput {MOUSE, JOYSTICK}
+var _camera_input_method := CameraInput.MOUSE
+
func _ready() -> void:
_camera_spring.spring_length = camera_distance
#_camera_input_direction *= mouse_sensitivity
if event is InputEventMouseMotion:
- _camera_input_method = CAMERA_MOUSE_INPUT
+ _camera_input_method = CameraInput.MOUSE
_camera_input_direction = event.screen_relative * mouse_sensitivity
elif event is InputEventJoypadMotion:
# TODO: add these settings!
- _camera_input_method = CAMERA_JOYSTICK_INPUT
+ _camera_input_method = CameraInput.JOYSTICK
_camera_input_direction = Input.get_vector("camera-left", "camera-right", "camera-up", "camera-down")
_camera_input_direction *= Vector2(joystick_sensitivity_x, -joystick_sensitivity_y)
_camera_pivot.rotation.y -= _camera_input_direction.x * mouse_sensitivity_x * delta
# reset mouse movement vector if mouse input
- if _camera_input_method == CAMERA_MOUSE_INPUT:
+ if _camera_input_method == CameraInput.MOUSE:
_camera_input_direction = Vector2.ZERO
# change spring length depending on player speed
#########
func _player_dash():
- var move_direction := _get_player_move_direction()
- if move_direction != Vector3.ZERO:
- var dash_local_pos = move_direction * dash_length
+ if _last_movement_direction != Vector3.ZERO:
+ var dash_local_pos = _last_movement_direction * dash_length
# TODO: check if valid position, crop the vector to last valid position
global_position += dash_local_pos