From fe1159cf6c245324d0930faf1909ae537ec766c4 Mon Sep 17 00:00:00 2001 From: penguinDragonTS <78127581+penguinDragonTS@users.noreply.github.com> Date: Fri, 9 Dec 2022 17:59:58 -0800 Subject: [PATCH] add mobs group with code added mob to mobs group via code b/c only using interface to create mobs group (in Mob scene root node groups tab) + adding the group queue clear line :: prevented my game from starting and had 1 fish on screen... --- .../first_2d_game/06.heads_up_display.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/getting_started/first_2d_game/06.heads_up_display.rst b/getting_started/first_2d_game/06.heads_up_display.rst index 4aff7a237b6..89ff448447e 100644 --- a/getting_started/first_2d_game/06.heads_up_display.rst +++ b/getting_started/first_2d_game/06.heads_up_display.rst @@ -413,6 +413,21 @@ click "Groups" and you can type a new group name and click "Add". .. image:: img/group_tab.png +You might also need to add the mobs directly with code. At the end of _on_MobTimer_timeout() where the mob is instanced you can put the following line. + +.. tabs:: + .. code-tab:: gdscript GDScript + + mob.add_to_group("mobs") + + .. code-tab:: csharp + + #someone else fill in + + .. code-tab:: cpp + + #someone else fill in + Now all mobs will be in the "mobs" group. We can then add the following line to the ``new_game()`` function in ``Main``: