mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-31 09:49:06 +03:00
* 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
19 lines
554 B
GDScript
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
|