add collecting coins
This commit is contained in:
18
scripts/game_manager.gd
Normal file
18
scripts/game_manager.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name GM
|
||||
extends Node
|
||||
|
||||
var player_state = {
|
||||
"coins": 0,
|
||||
}
|
||||
|
||||
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
|
Reference in New Issue
Block a user