Add HUD component and update player state management for lives

This commit is contained in:
2025-04-27 02:02:03 +02:00
parent 0c1192536c
commit c3304408b9
10 changed files with 286 additions and 5 deletions

View File

@@ -2,17 +2,38 @@ class_name GM
extends Node
var player_state = {
"coins": 0,
}
"coins": 0,
"lives": 3,
}
func add_coins(amount: int) -> void:
player_state["coins"] += amount
func set_coins(amount: int) -> void:
player_state["coins"] = amount
func get_coins() -> int:
return player_state["coins"]
func remove_coins(amount: int) -> void:
player_state["coins"] -= amount
player_state["coins"] -= amount
func add_lives(amount: int) -> void:
player_state["lives"] += amount
func remove_lives(amount: int) -> void:
player_state["lives"] -= amount
func set_lives(amount: int) -> void:
player_state["lives"] = amount
func get_lives() -> int:
return player_state["lives"]