2024-02-07 15:33:20 +01:00

23 lines
567 B
GDScript

class_name PlayerController
extends Controller
var move: Vector2
func _unhandled_input(event):
if Global.interacting_with_ui:
return
move = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
character.direction = (Global.camera.transform.basis * Vector3(move.x, 0, move.y))
character.direction.y = 0
character.direction = character.direction.normalized()
if event.is_action_pressed("jump"):
character.jump()
if event.is_action_pressed("dash"):
character.dash()
if event.is_action_pressed("attack"):
character.attack()