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,35 +3,36 @@ extends BaseState
signal PlayerBeganDrawingBow
@export var strafing_speed := 35
@export var movement_componenent: MovementComponent
@export var body: CharacterBody2D
var used_item_action: String
var animation_finished := false
var _used_item_action: String
var _animation_finished := false
var _movement_componenent: MovementComponent
func GetStateEnum() -> PlayerStateMachine.States:
return PlayerStateMachine.States.DRAWING_BOW
func Enter(extra_parameters: Dictionary) -> void:
animation_finished = false
used_item_action = extra_parameters.action_name
_animation_finished = false
_used_item_action = extra_parameters.action_name
_movement_componenent = ComponentUtils.GetMovementComponent(body)
PlayerBeganDrawingBow.emit()
func Update(_delta: float) -> void:
if !animation_finished:
if !_animation_finished:
return
if !Input.is_action_pressed(used_item_action):
if !Input.is_action_pressed(_used_item_action):
state_machine.QueueStateChange(PlayerStateMachine.States.FIRING_ARROW)
return
var movement_vector := movement_componenent.movement_vector
var movement_vector := _movement_componenent.movement_vector
if movement_vector != Vector2.ZERO:
body.velocity = movement_vector * strafing_speed
body.move_and_slide()
func OnDrawingBowAnimationFinished() -> void:
animation_finished = true
_animation_finished = true