15 lines
489 B
GDScript
15 lines
489 B
GDScript
class_name Player extends CharacterBody2D
|
|
|
|
|
|
const DEADZONE = 0.1
|
|
|
|
@export var max_speed: float = 300.0
|
|
|
|
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
|
@onready var state_machine: StateMachine = $StateMachine
|
|
|
|
|
|
func get_movement_vector() -> Vector2:
|
|
var x_mov: float = Input.get_action_strength('move_right') - Input.get_action_strength('move_left')
|
|
var y_mov: float = Input.get_action_strength('move_down') - Input.get_action_strength('move_up')
|
|
return Vector2(x_mov, y_mov)
|