26 lines
652 B
GDScript
26 lines
652 B
GDScript
extends Node
|
|
|
|
var player: Resource
|
|
var coinsCollectedTotal: int = 0
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
print("GameManager is loaded")
|
|
player = load("res://scripts/resources/playerStats.tres")
|
|
|
|
func coinCollected():
|
|
coinsCollectedTotal += 1
|
|
print("coins collected " + str(coinsCollectedTotal))
|
|
|
|
func playerDamage():
|
|
if player.currentHealth > 0:
|
|
player.currentHealth -= 20
|
|
print("player health is now " + str(player.currentHealth))
|
|
|
|
func resetPlayer():
|
|
player.currentHealth = player.maxHealth
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|