@@ -34,7 +34,13 @@ In this scenario, you want the user to press the four directional keys (up/left/
34
34
or W/A/S/D) and move in the selected direction. The name "8-way movement" comes from the
35
35
fact that the player can move diagonally by pressing two keys at the same time.
36
36
37
- .. image :: img/movement_8way.gif
37
+ .. video :: video/movement_8way.webm
38
+ :alt: 8-way movement
39
+ :autoplay:
40
+ :loop:
41
+ :muted:
42
+ :align: default
43
+ :width: 100%
38
44
39
45
Add a script to the character body and add the following code:
40
46
@@ -98,7 +104,13 @@ This type of movement is sometimes called "Asteroids-style" because it resembles
98
104
how that classic arcade game worked. Pressing left/right rotates the character,
99
105
while up/down moves it forward or backward in whatever direction it's facing.
100
106
101
- .. image :: img/movement_rotate1.gif
107
+ .. video :: video/movement_rotate_keyboard.webm
108
+ :alt: Rotation + movement
109
+ :autoplay:
110
+ :loop:
111
+ :muted:
112
+ :align: default
113
+ :width: 100%
102
114
103
115
.. tabs ::
104
116
.. code-tab :: gdscript GDScript
@@ -160,7 +172,13 @@ This style of movement is a variation of the previous one. This time, the direct
160
172
is set by the mouse position instead of the keyboard. The character will always
161
173
"look at" the mouse pointer. The forward/back inputs remain the same, however.
162
174
163
- .. image :: img/movement_rotate2.gif
175
+ .. video :: video/movement_rotate_mouse.webm
176
+ :alt: Rotation + movement (mouse)
177
+ :autoplay:
178
+ :loop:
179
+ :muted:
180
+ :align: default
181
+ :width: 100%
164
182
165
183
.. tabs ::
166
184
.. code-tab :: gdscript GDScript
@@ -219,7 +237,13 @@ Click-and-move
219
237
This last example uses only the mouse to control the character. Clicking
220
238
on the screen will cause the player to move to the target location.
221
239
222
- .. image :: img/movement_click.gif
240
+ .. video :: video/movement_click.webm
241
+ :alt: Click-and-move
242
+ :autoplay:
243
+ :loop:
244
+ :muted:
245
+ :align: default
246
+ :width: 100%
223
247
224
248
.. tabs ::
225
249
.. code-tab :: gdscript GDScript
0 commit comments