23 lines
599 B
GDScript3
Raw Normal View History

2024-01-18 22:35:17 +00:00
class_name PlayerController
2024-01-20 21:18:58 +00:00
extends Node
2024-01-18 22:35:17 +00:00
2024-01-22 16:12:26 +00:00
## The character that we're controlling.
2024-01-18 22:35:17 +00:00
@export var character: Character
2024-01-22 16:12:26 +00:00
2024-01-18 22:35:17 +00:00
var move: Vector2
func _input(_event):
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 Input.is_action_just_pressed("jump"):
character.jump()
2024-01-20 21:18:58 +00:00
2024-01-18 22:35:17 +00:00
if Input.is_action_just_pressed("dash"):
character.dash()
if Input.is_action_just_pressed("attack"):
character.attack()