From bb82f03e273887603fd5aa8720877d49406a6068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guerric=20Hach=C3=A9?= Date: Thu, 14 Sep 2023 15:34:57 -0700 Subject: [PATCH 1/3] Update to the 2D tutorial Issue #41283 is currently disrupting the flow of the official 2D tutorial for folks with external script editors. This change is to update the tutorial to acknowledge this bug and provide newcomers with clearer guidelines on how to complete the tutorial despite the bug. It also clarifies a potential point of confusion about how the editor communicates connection between signals and script functions. --- .../first_2d_game/03.coding_the_player.rst | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/getting_started/first_2d_game/03.coding_the_player.rst b/getting_started/first_2d_game/03.coding_the_player.rst index 95be85706a1..55e88639232 100644 --- a/getting_started/first_2d_game/03.coding_the_player.rst +++ b/getting_started/first_2d_game/03.coding_the_player.rst @@ -476,14 +476,28 @@ Inspector tab to see the list of signals the player can emit: Notice our custom "hit" signal is there as well! Since our enemies are going to be ``RigidBody2D`` nodes, we want the ``body_entered(body: Node2D)`` signal. This signal will be emitted when a body contacts the player. Click "Connect.." and -the "Connect a Signal" window appears. We don't need to change any of these -settings so click "Connect" again. Godot will automatically create a function in -your player's script. +the "Connect a Signal" window appears. + +Godot will attempt to create a function with that exact name directly in script +for you. You don't need to change the default settings right now. + +.. warning:: + + Normally Godot is meant to automatically create a function for the signal to + connect to directly in the script. However, if you're using an external text + editor (for example, Visual Studio Code), a bug currently prevents Godot from doing + so. You'll be sent to your external editor, but the new function won't be there. + + In this case, you'll need to write the function yourself into the Player's + script file. .. image:: img/player_signal_connection.webp -Note the green icon indicating that a signal is connected to this function. Add -this code to the function: +Note the green icon indicating that a signal is connected to this function; this does +not mean the function exists, only that the signal will attempt to connect to a function +with that name, so double-check that the spelling of the function matches exactly! + +Next, add this code to the function: .. tabs:: .. code-tab:: gdscript GDScript From 175e0b320486387549c8b7f4e039723d3309611e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guerric=20Hach=C3=A9?= Date: Wed, 22 Nov 2023 09:14:05 -0800 Subject: [PATCH 2/3] Applying suggested changes I agree with these suggested changes! Applying Co-authored-by: Matthew --- .../first_2d_game/03.coding_the_player.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/getting_started/first_2d_game/03.coding_the_player.rst b/getting_started/first_2d_game/03.coding_the_player.rst index 55e88639232..85e3ff4871f 100644 --- a/getting_started/first_2d_game/03.coding_the_player.rst +++ b/getting_started/first_2d_game/03.coding_the_player.rst @@ -478,15 +478,16 @@ be ``RigidBody2D`` nodes, we want the ``body_entered(body: Node2D)`` signal. Thi signal will be emitted when a body contacts the player. Click "Connect.." and the "Connect a Signal" window appears. -Godot will attempt to create a function with that exact name directly in script +Godot will create a function with that exact name directly in script for you. You don't need to change the default settings right now. .. warning:: - Normally Godot is meant to automatically create a function for the signal to - connect to directly in the script. However, if you're using an external text - editor (for example, Visual Studio Code), a bug currently prevents Godot from doing - so. You'll be sent to your external editor, but the new function won't be there. +.. The issue for this bug is #41283 + + If you're using an external text editor (for example, Visual Studio Code), + a bug currently prevents Godot from doing so. You'll be sent to your external + editor, but the new function won't be there. In this case, you'll need to write the function yourself into the Player's script file. From d5e8a57ab98aa35ec3d2a6253194797f8bf1351f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guerric=20Hach=C3=A9?= Date: Wed, 22 Nov 2023 09:25:06 -0800 Subject: [PATCH 3/3] Update getting_started/first_2d_game/03.coding_the_player.rst Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> --- getting_started/first_2d_game/03.coding_the_player.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/first_2d_game/03.coding_the_player.rst b/getting_started/first_2d_game/03.coding_the_player.rst index 85e3ff4871f..6eda62c5c66 100644 --- a/getting_started/first_2d_game/03.coding_the_player.rst +++ b/getting_started/first_2d_game/03.coding_the_player.rst @@ -483,7 +483,7 @@ for you. You don't need to change the default settings right now. .. warning:: -.. The issue for this bug is #41283 + .. The issue for this bug is #41283 If you're using an external text editor (for example, Visual Studio Code), a bug currently prevents Godot from doing so. You'll be sent to your external