File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
getting_started/step_by_step Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,32 @@ right arrows on the keyboard or left and right on a gamepad's D-pad.
7979Finally, we use the ``direction `` as a multiplier when we update the node's
8080``rotation ``: ``rotation += angular_speed * direction * delta ``.
8181
82+ Comment out the lines ``var velocity = Vector2.UP.rotated(rotation) * speed `` and ``position += velocity * delta `` like this:
83+
84+ .. tabs ::
85+
86+ .. code-tab :: gdscript GDScript
87+
88+ #var velocity = Vector2.UP.rotated(rotation) * speed
89+
90+ #position += velocity * delta
91+
92+ .. code-tab :: csharp C#
93+
94+ //var velocity = Vector2.Up.Rotated(Rotation) * _speed;
95+
96+ //Position += velocity * (float)delta;
97+
98+ This will ignore the code that moved the icon's position in a circle without user input from the previous exercise.
99+
82100If you run the scene with this code, the icon should rotate when you press
83101:kbd: `Left ` and :kbd: `Right `.
84102
85103Moving when pressing "up"
86104-------------------------
87105
88106To only move when pressing a key, we need to modify the code that calculates the
89- velocity. Replace the line starting with ``var velocity `` with the code below.
107+ velocity. Uncomment the code and replace the line starting with ``var velocity `` with the code below.
90108
91109.. tabs ::
92110 .. code-tab :: gdscript GDScript
You can’t perform that action at this time.
0 commit comments