This commit is contained in:
2026-03-28 21:34:31 -05:00
parent 5fb4a96159
commit 9f057f6c16
32 changed files with 444 additions and 65 deletions

View File

@@ -3,24 +3,27 @@ extends BaseState
signal StartedWalking
@export var walking_speed := 100
@export var movement_component: MovementComponent
@export var direction_component: FacingDirectionComponent
@export var body: CharacterBody2D
var _movement_component: MovementComponent
func GetStateEnum() -> PlayerStateMachine.States:
return PlayerStateMachine.States.WALKING
func Enter(_extra_parameters: Dictionary) -> void:
_movement_component = ComponentUtils.GetMovementComponent(body)
StartedWalking.emit()
func Update(_delta: float) -> void:
if movement_component.movement_vector == Vector2.ZERO:
var movement_vector := _movement_component.movement_vector
if movement_vector == Vector2.ZERO:
state_machine.QueueStateChange(PlayerStateMachine.States.IDLE)
return
var movement_vector := movement_component.movement_vector
body.velocity = movement_vector * walking_speed
body.move_and_slide()