25 lines
550 B
GDScript
25 lines
550 B
GDScript
extends Node
|
|
|
|
var coinscollected:int = 0
|
|
var player:Resource
|
|
|
|
signal playerdeath
|
|
func _ready() -> void:
|
|
print("Game Controller is on")
|
|
player = load("res://Sripts/Resources/player.tres")
|
|
|
|
func coincollected():
|
|
coinscollected +=1
|
|
print("Gamecontroller Coin Collected : "+str(coinscollected) )
|
|
func resetplayer():
|
|
player.current_health = player.max_health
|
|
|
|
func playerdamaged():
|
|
player.current_health -= 20
|
|
print("player health is : "+str(player.current_health))
|
|
# is player dead
|
|
if player.current_health <=0:
|
|
#Death
|
|
playerdeath.emit()
|
|
|