23 lines
567 B
GDScript3
Raw Normal View History

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