SeptemberGame/scripts/gamecontroller.gd

39 lines
898 B
GDScript3
Raw Normal View History

extends Node2D
var coinsCollectedTotal:int = 0
var totalCoinsAvailable:int = 0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_trigger_fired(intent, body):
print("GC knows trigger fired "+intent)
match intent:
"destroy":
print("destroy this thing")
body.queue_free()
"powerup":
print("power up this thing")
func _on_coin_collected(body, coin):
print("GC knows coin collected")
coinsCollectedTotal +=1
coin.queue_free()
if coinsCollectedTotal >= totalCoinsAvailable:
print("You won the level!")
func totalCoins(value):
totalCoinsAvailable = value
func _on_slime_damage(body, slime):
print("GC knows slime damage")
func totalEnemies(value):
print("GC knows total enemies "+str(value))