From 3825ba44168ad38c84cb09feb1356d3e464f8d29 Mon Sep 17 00:00:00 2001 From: Kyle Starr Date: Thu, 4 Jan 2024 21:54:56 -0800 Subject: [PATCH 1/4] Update scripting_player_input.rst Commenting out code from the previous exercise that causes the icon to float up, making it difficult for users to see the example of directional input. --- .../step_by_step/scripting_player_input.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/getting_started/step_by_step/scripting_player_input.rst b/getting_started/step_by_step/scripting_player_input.rst index 03a34d1f080..704ab2bec71 100644 --- a/getting_started/step_by_step/scripting_player_input.rst +++ b/getting_started/step_by_step/scripting_player_input.rst @@ -79,6 +79,24 @@ right arrows on the keyboard or left and right on a gamepad's D-pad. Finally, we use the ``direction`` as a multiplier when we update the node's ``rotation``: ``rotation += angular_speed * direction * delta``. +Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed`` and ``position += velocity * delta`` with the code below: + +.. tabs:: + + .. code-tab:: gdscript GDScript + + #var velocity = Vector2.UP.rotated(rotation) * speed + + #position += velocity * delta + + .. code-tab:: csharp C# + + // var velocity = Vector2.Up.Rotated(Rotation) * _speed; + + // Position += velocity * (float)delta; + +This will ignore the code that moved the icon's position in a circles without user input from the previous exercise. + If you run the scene with this code, the icon should rotate when you press :kbd:`Left` and :kbd:`Right`. From ded85ebb9441342cbcfd08bfd08cbb40163173e5 Mon Sep 17 00:00:00 2001 From: Kyle Starr Date: Sun, 7 Jan 2024 13:59:26 -0800 Subject: [PATCH 2/4] Update getting_started/step_by_step/scripting_player_input.rst Removing unnecessary spaces in C# comments Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> --- getting_started/step_by_step/scripting_player_input.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/step_by_step/scripting_player_input.rst b/getting_started/step_by_step/scripting_player_input.rst index 704ab2bec71..d72ecd6de73 100644 --- a/getting_started/step_by_step/scripting_player_input.rst +++ b/getting_started/step_by_step/scripting_player_input.rst @@ -91,9 +91,9 @@ Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed`` an .. code-tab:: csharp C# - // var velocity = Vector2.Up.Rotated(Rotation) * _speed; + //var velocity = Vector2.Up.Rotated(Rotation) * _speed; - // Position += velocity * (float)delta; + //Position += velocity * (float)delta; This will ignore the code that moved the icon's position in a circles without user input from the previous exercise. From e4268cf58004cf82d3dfbbc0faa94e5e26e02fbd Mon Sep 17 00:00:00 2001 From: Kyle Starr Date: Thu, 25 Jan 2024 20:21:45 -0800 Subject: [PATCH 3/4] Update getting_started/step_by_step/scripting_player_input.rst Updating phrasing per suggestion Co-authored-by: Matthew --- getting_started/step_by_step/scripting_player_input.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting_started/step_by_step/scripting_player_input.rst b/getting_started/step_by_step/scripting_player_input.rst index d72ecd6de73..49f15080658 100644 --- a/getting_started/step_by_step/scripting_player_input.rst +++ b/getting_started/step_by_step/scripting_player_input.rst @@ -79,7 +79,7 @@ right arrows on the keyboard or left and right on a gamepad's D-pad. Finally, we use the ``direction`` as a multiplier when we update the node's ``rotation``: ``rotation += angular_speed * direction * delta``. -Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed`` and ``position += velocity * delta`` with the code below: +Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed`` and ``position += velocity * delta`` like this: .. tabs:: From 16a90c81c28cd306f590588e285c6d43ef99345a Mon Sep 17 00:00:00 2001 From: Kyle Starr Date: Thu, 25 Jan 2024 20:32:02 -0800 Subject: [PATCH 4/4] Update scripting_player_input.rst Informing user to uncomment the commented code. --- getting_started/step_by_step/scripting_player_input.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/step_by_step/scripting_player_input.rst b/getting_started/step_by_step/scripting_player_input.rst index 49f15080658..b57eea4246b 100644 --- a/getting_started/step_by_step/scripting_player_input.rst +++ b/getting_started/step_by_step/scripting_player_input.rst @@ -95,7 +95,7 @@ Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed`` an //Position += velocity * (float)delta; -This will ignore the code that moved the icon's position in a circles without user input from the previous exercise. +This will ignore the code that moved the icon's position in a circle without user input from the previous exercise. If you run the scene with this code, the icon should rotate when you press :kbd:`Left` and :kbd:`Right`. @@ -104,7 +104,7 @@ Moving when pressing "up" ------------------------- To only move when pressing a key, we need to modify the code that calculates the -velocity. Replace the line starting with ``var velocity`` with the code below. +velocity. Uncomment the code and replace the line starting with ``var velocity`` with the code below. .. tabs:: .. code-tab:: gdscript GDScript