stick-the-quick/characters/controllers/player_character_controller.gd

19 lines
655 B
GDScript3
Raw Normal View History

2025-03-28 19:02:51 -07:00
class_name PlayerCharacterController extends Node
2025-03-29 02:12:43 -07:00
@export var character: Character
@export var camera: Camera3D
2025-03-28 19:02:51 -07:00
2025-03-29 02:12:43 -07:00
func _physics_process(_delta: float) -> void:
var move_input := Vector2(
Input.get_axis(&'move_left', &'move_right'),
Input.get_axis(&'move_forward', &'move_backward')
)
character.global_impetus = (
move_input.x*camera.global_basis.x +
move_input.y*camera.global_basis.z
)
character.jump_impetus = Input.is_action_pressed(&'jump')
character.action1_impetus = Input.is_action_pressed(&'action1')
character.action2_impetus = Input.is_action_pressed(&'action2')
character.interact_impetus = Input.is_action_pressed(&'interact')