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

View File

@@ -8,9 +8,19 @@ func cutscenePause() -> void:
func cutsceneResume() -> void:
cutscenePaused = false
func isMovementPaused() -> bool:
if cutscenePaused:
return true
if !UI.TEXTBOX.isClosed:
return true
return false
if UI.PAUSE.isOpen():
return true
return false
func menuPause() -> void:
UI.PAUSE.open()

View File

@@ -1,3 +1,4 @@
class_name UISingleton extends Control
@export var TEXTBOX: VNTextbox
@export var TEXTBOX: VNTextbox
@export var PAUSE: PauseMenu

View File

@@ -0,0 +1,4 @@
class_name PauseMain extends VBoxContainer
func _ready() -> void:
visible = true

View File

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

View File

@@ -0,0 +1,17 @@
class_name PauseMenu extends Control
@export var MAIN:PauseMain
func _ready() -> void:
hide()
func isOpen() -> bool:
return visible
func open() -> void:
visible = true
MAIN.visible = true
func close() -> void:
visible = false
MAIN.visible = false

View File

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