Moved player input

This commit is contained in:
2025-07-01 15:50:08 -05:00
parent 3e95481282
commit 58126341ba
14 changed files with 138 additions and 12 deletions

View File

@@ -0,0 +1,13 @@
class_name PlayerInput extends Node
@export var interaction:PlayerInteraction
@export var movement:PlayerMovement
func _process(delta: float) -> void:
if Input.is_action_just_pressed("pause"):
PAUSE.menuPause()
if Input.is_action_just_pressed("interact"):
interaction.interact()
movement.inputDir = Input.get_vector("move_left", "move_right", "move_back", "move_forward").normalized()

View File

@@ -0,0 +1 @@
uid://bdv1fj1pwknrs

View File

@@ -8,13 +8,10 @@ func canInteract() -> bool:
return false
return true
func _process(delta: float) -> void:
func interact() -> void:
if !canInteract():
return
if !Input.is_action_just_pressed("interact"):
return
var overlapping = interactableArea.get_overlapping_areas()
var interactable: InteractableArea = null

View File

@@ -1,9 +1,10 @@
class_name PlayerMovement extends Node
const TURN_SPEED = 12.0
const TURN_SPEED = 30.0
const SPEED = 8.0
@export var player:CharacterBody3D
var inputDir:Vector2 = Vector2.ZERO
func canMove() -> bool:
if PAUSE.isMovementPaused():
@@ -18,8 +19,6 @@ func _physics_process(delta:float) -> void:
# Player movement
var directionAdjusted = Vector3.ZERO
if canMove():
var inputDir = Input.get_vector("move_left", "move_right", "move_back", "move_forward").normalized()
# Use camera orientation for movement direction
var cam_basis = cameraCurrent.global_transform.basis
# Forward and right vectors, ignore vertical component