AprilGameExample/Scripts/gameController.gd

24 lines
659 B
GDScript

class_name GameController extends Node2D
signal destroySignal(body)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
get_window().grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_triggerSignal(body: Variant, intentMessage: Variant) -> void:
print("GC knows about a trigger!")
if body.is_in_group("destructible") and intentMessage == "destroy":
destroySignal.emit(body)
func totalCrates(numberOfCrates:int)->void:
print("GC knows total crates: "+str(numberOfCrates))
if numberOfCrates <=0:
print("You WON!!!!")