Turns the sandbox into a survival roguelike loop: outfit your gladiator with banked gold, enter the arena, earn gold from kills and wave clears, die, keep 10% of your total value (floored at the 500 fresh-start). Economy (GameState autoload): - banked_gold, owned items, and loadout persist to user://save.cfg - Kill gold (basic 10g, armed 25g) credited server-side to the killer - Wave-clear bonus (25 + 5/wave) for all players; wave synced to peers - Death settlement liquidates gear, guarded against double-fire Character creation / shop: - Menu reframed: armory shop + live Character Sheet loadout preview - Character Sheet gains preview mode (renders from loadout, no player) - Buy/Equip with hand rules; two-handers and off-hands displace each other symmetrically (shop and in-game pickups) - Chosen loadout auto-equips on spawn via existing RPC path Combat feel: - Attacks snap to camera facing and lock direction for the swing - Dash commits to its direction for the full duration - Weapon slots show name text when no icon is set - Hitbox/hurtbox debug meshes hidden by default (H toggles) Death is final: players no longer respawn; a results screen shows waves, time, kills, and the settlement, then returns to camp. Armed enemies no longer respawn (were an infinite gold farm and respawned invisible).
58 lines
1.6 KiB
GDScript
58 lines
1.6 KiB
GDScript
extends Node3D
|
|
class_name Body
|
|
|
|
const LERP_VELOCITY: float = 0.15
|
|
|
|
@export_category("Objects")
|
|
@export var _character: CharacterBody3D = null
|
|
@export var animation_player: AnimationPlayer = null
|
|
|
|
func apply_rotation(_velocity: Vector3) -> void:
|
|
var new_rotation_y = lerp_angle(rotation.y, atan2(-_velocity.x, -_velocity.z), LERP_VELOCITY)
|
|
rotation.y = new_rotation_y
|
|
|
|
# rpc("sync_player_rotation", new_rotation_y)
|
|
|
|
## Instantly face a direction (no lerp) - used to lock attacks to camera facing
|
|
func snap_rotation(_direction: Vector3) -> void:
|
|
rotation.y = atan2(-_direction.x, -_direction.z)
|
|
|
|
func animate(_velocity: Vector3) -> void:
|
|
# Don't override attack animation if it's playing
|
|
if animation_player.is_playing() and animation_player.current_animation == "Attack1":
|
|
return
|
|
|
|
# Check if we're dashing
|
|
if _character._is_dashing:
|
|
if animation_player.current_animation != "Jump2":
|
|
animation_player.play("Jump2")
|
|
return
|
|
|
|
if not _character.is_on_floor():
|
|
if _velocity.y < 0:
|
|
animation_player.play("Fall")
|
|
else:
|
|
animation_player.play("Jump")
|
|
return
|
|
|
|
if _velocity:
|
|
if _character.is_running() and _character.is_on_floor():
|
|
animation_player.play("Sprint")
|
|
return
|
|
|
|
animation_player.play("Run")
|
|
return
|
|
|
|
animation_player.play("Idle")
|
|
|
|
func play_attack() -> void:
|
|
if animation_player:
|
|
# Play attack animation once (don't loop)
|
|
animation_player.play("Attack1", -1, 1.0)
|
|
# Ensure it doesn't loop
|
|
animation_player.animation_set_next("Attack1", "")
|
|
|
|
# @rpc("any_peer", "reliable")
|
|
# func sync_player_rotation(rotation_y: float) -> void:
|
|
# rotation.y = rotation_y
|