From 8a23abe2ea7edc08efd75be403ebe89c5bb1783a Mon Sep 17 00:00:00 2001 From: OddlyTimbot Date: Mon, 12 May 2025 17:48:19 -0400 Subject: [PATCH] format update, additional destroy function in docs --- week5/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/week5/README.md b/week5/README.md index 0acf0d5..e1ebe9b 100644 --- a/week5/README.md +++ b/week5/README.md @@ -72,6 +72,16 @@ func _on_trigger_fired(effect: Variant, body: Variant) -> void: Now if something hits the "destroy" trigger, the game controller checks to see if it is a crate, and if so signals to destroy it. This is heard by the scene manager, who deletes the crate. +In `Scenemanager`: + +``` +func destroy(body): + if body is Crate: + body.queue_free() +``` + +Optionally, the `Scenemanager`could now count up the number of remaining crates, and tell the `Gamecontroller` how many there are. + ### Example: Loading Scenes Lets move the option to load scenes to the scene manager as well, and trigger it using a custom signal from the game controller.