From 27944792d1c731bc2cf57a5720dbf41db9a1f391 Mon Sep 17 00:00:00 2001 From: MessinaBrothers Date: Sun, 2 Jun 2019 09:53:59 -0700 Subject: [PATCH] Add C# example to "Removing old creeps" The example includes code for GDScript, but not C# --- getting_started/step_by_step/your_first_game.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/getting_started/step_by_step/your_first_game.rst b/getting_started/step_by_step/your_first_game.rst index 6cca55ea5..6a9d6fca7 100644 --- a/getting_started/step_by_step/your_first_game.rst +++ b/getting_started/step_by_step/your_first_game.rst @@ -1145,6 +1145,13 @@ current node at the end of the current frame. func _on_start_game(): queue_free() + + .. code-tab:: csharp + + public void OnStartGame() + { + QueueFree(); + } Then in ``Main.gd`` add a new line inside the ``_on_MobTimer_timeout()`` function, at the end. @@ -1154,6 +1161,10 @@ at the end. $HUD.connect("start_game", mob, "_on_start_game") + .. code-tab:: csharp + + GetNode("HUD").Connect("StartGame", mobInstance, "OnStartGame"); + This line tells the new Mob node (referenced by the ``mob`` variable) to respond to any ``start_game`` signal emitted by the ``HUD`` node by running its ``_on_start_game()`` function.