Moved player input
This commit is contained in:
13
scripts/entities/player/PlayerInput.gd
Normal file
13
scripts/entities/player/PlayerInput.gd
Normal 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()
|
1
scripts/entities/player/PlayerInput.gd.uid
Normal file
1
scripts/entities/player/PlayerInput.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bdv1fj1pwknrs
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user