WIP checkpoint: Implement Godot dedicated server scene + player spawning

This commit is contained in:
2026-08-17 18:15:38 +00:00
parent 11e812cb6b
commit 37a311b0c5
3 changed files with 45 additions and 28 deletions
+6 -7
View File
@@ -4,9 +4,6 @@ extends CharacterBody3D
## Represents a connected player on the server. Handles movement,
## input processing, and state synchronization.
class_name PlayerNode
# --- Signals ---
signal health_changed(new_health: int)
signal player_died(player_node: PlayerNode)
@@ -65,12 +62,14 @@ func _physics_process(delta: float) -> void:
# Apply friction on ground
if is_on_floor():
var move_dir = velocity.xz
var move_dir := Vector2(velocity.x, velocity.z)
if move_dir.length() > 0.01:
var friction_factor = clampf(FRICTION * delta, 0.0, 1.0)
velocity.xz = move_dir.normalized() * move_dir.length() * (1.0 - friction_factor)
var friction_factor := clampf(FRICTION * delta, 0.0, 1.0)
velocity.x = move_dir.normalized().x * move_dir.length() * (1.0 - friction_factor)
velocity.z = move_dir.normalized().y * move_dir.length() * (1.0 - friction_factor)
else:
velocity.xz = Vector2.ZERO
velocity.x = 0.0
velocity.z = 0.0
# Move and slide
velocity.y = clampf(velocity.y, -max_fall_speed, max_fall_speed)