Files
godot-demo-projects/2d/finite_state_machine/player/states/motion/motion.gd
A Thousand Ships 0343cedd48 General proofreading (#1262)
* General proofreading for grammar and spelling
* General formatting
* Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
2025-10-11 01:39:59 -07:00

19 lines
554 B
GDScript

extends "res://player/player_state.gd"
# Collection of important methods to handle direction and animation.
func handle_input(input_event: InputEvent) -> void:
if input_event.is_action_pressed(&"simulate_damage"):
finished.emit(PLAYER_STATE.stagger)
func get_input_direction() -> Vector2:
return Vector2(
Input.get_axis(&"move_left", &"move_right"),
Input.get_axis(&"move_up", &"move_down")
)
func update_look_direction(direction: Vector2) -> void:
if direction and owner.look_direction != direction:
owner.look_direction = direction