Gladiator arena: gold economy, outfitting shop, permadeath runs
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).
This commit is contained in:
@@ -10,6 +10,7 @@ var character_sheet: Control = null
|
||||
var tab_hint: Control = null
|
||||
var keybind_hint: Control = null
|
||||
var escape_menu: Control = null
|
||||
var run_results: Control = null
|
||||
|
||||
# Player reference
|
||||
var local_player: Character = null
|
||||
@@ -157,6 +158,26 @@ func show_hud():
|
||||
func hide_hud():
|
||||
hide()
|
||||
|
||||
## Tear down all UI components (used when returning to the menu after a run).
|
||||
## The HUD is an autoload, so its children survive scene reloads unless freed.
|
||||
func reset():
|
||||
if local_player and is_instance_valid(local_player):
|
||||
_disconnect_player_signals()
|
||||
local_player = null
|
||||
|
||||
for child in get_children():
|
||||
child.queue_free()
|
||||
|
||||
action_bar = null
|
||||
unit_frame = null
|
||||
target_frame = null
|
||||
character_sheet = null
|
||||
tab_hint = null
|
||||
keybind_hint = null
|
||||
escape_menu = null
|
||||
run_results = null
|
||||
print("[HUD] Reset - all UI components removed")
|
||||
|
||||
## Player signal callbacks
|
||||
func _on_player_health_changed(old_health: float, new_health: float):
|
||||
# Update unit frame
|
||||
@@ -164,8 +185,21 @@ func _on_player_health_changed(old_health: float, new_health: float):
|
||||
unit_frame.update_health(new_health, local_player.max_health)
|
||||
|
||||
func _on_player_died(killer_id: int):
|
||||
print("[HUD] Player died")
|
||||
# Could show death screen or respawn timer here
|
||||
print("[HUD] Player died - ending run")
|
||||
_show_run_results()
|
||||
|
||||
## End the local player's run and show the results screen.
|
||||
## GameState.end_run() is guarded against double-calls (died can fire twice on host).
|
||||
func _show_run_results():
|
||||
if run_results and is_instance_valid(run_results):
|
||||
return # Already showing
|
||||
|
||||
var stats = GameState.end_run()
|
||||
|
||||
var results_script = load("res://level/ui/scripts/run_results.gd")
|
||||
run_results = results_script.new()
|
||||
run_results.setup(stats)
|
||||
add_child(run_results)
|
||||
|
||||
func _on_player_respawned():
|
||||
print("[HUD] Player respawned")
|
||||
|
||||
Reference in New Issue
Block a user