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

19 lines
655 B
GDScript

class_name PlayerCharacterController extends Node
@export var character: Character
@export var camera: Camera3D
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')