Browse Source

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.
Kyle Starr 1 year ago
parent
commit
3825ba4416
1 changed files with 18 additions and 0 deletions
  1. 18 0
      getting_started/step_by_step/scripting_player_input.rst

+ 18 - 0
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
 Finally, we use the ``direction`` as a multiplier when we update the node's
 ``rotation``: ``rotation += angular_speed * direction * delta``.
 ``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
 If you run the scene with this code, the icon should rotate when you press
 :kbd:`Left` and :kbd:`Right`.
 :kbd:`Left` and :kbd:`Right`.