23 lines
567 B
GDScript3
Raw Normal View History

2024-01-18 23:35:17 +01:00
class_name PlayerController
2024-01-29 23:16:06 +01:00
extends Controller
2024-01-22 17:12:26 +01:00
2024-01-18 23:35:17 +01:00
var move: Vector2
2024-02-07 15:33:20 +01:00
func _unhandled_input(event):
2024-01-28 22:08:08 +01:00
if Global.interacting_with_ui:
return
2024-01-18 23:35:17 +01:00
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()
2024-02-07 15:33:20 +01:00
if event.is_action_pressed("jump"):
2024-01-18 23:35:17 +01:00
character.jump()
2024-01-20 22:18:58 +01:00
2024-02-07 15:33:20 +01:00
if event.is_action_pressed("dash"):
2024-01-18 23:35:17 +01:00
character.dash()
2024-02-07 15:33:20 +01:00
if event.is_action_pressed("attack"):
2024-01-18 23:35:17 +01:00
character.attack()