feat(progression): XP, niveaux et popups flottants (+N XP)

Nouvel autoload PlayerProgress qui gagne de l'XP sur:
- cassage de blocs (gain variable selon le type: perle, épave, coral > sand)
- collecte de perles (+25)
- crafting (+10)
- paliers de profondeur atteints (+20 à 10/25/50/75/100m)

HUD: barre XP + label niveau en bas centre, bannière "NIVEAU X" au level-up
(son bulle + fade). Popup 3D "+N XP" spawn au point d'action.

Boucle court-terme dopamine: chaque action = feedback visuel immédiat.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 18:08:26 +00:00
parent 982a4ec23d
commit 984754183f
7 changed files with 260 additions and 2 deletions

View File

@@ -112,5 +112,13 @@ func _on_pearl_collected(item_id: int) -> void:
return
main.inventory.add_item(item_id, 1)
var am: Node = get_node_or_null("/root/AudioManager")
var player_pos: Vector3 = Vector3.ZERO
if is_instance_valid(_player_node):
player_pos = _player_node.global_position
if am != null and am.has_method("play_bubble_sfx") and is_instance_valid(_player_node):
am.call("play_bubble_sfx", _player_node.global_position)
am.call("play_bubble_sfx", player_pos)
var pp: Node = get_node_or_null("/root/PlayerProgress")
if pp != null:
pp.award(pp.XP_PEARL, "perle", player_pos)
if main.has_method("_spawn_xp_popup"):
main.call("_spawn_xp_popup", pp.XP_PEARL, player_pos + Vector3(0, 1.2, 0))