Skip to content

Commit 8debbc2

Browse files
authored
Move position setting code to be before direction in The main game scene (#10452)
Handle the position before the direction to make the code easier to follow.
1 parent dc4cc37 commit 8debbc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

getting_started/first_2d_game/05.the_main_game_scene.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ Note that a new instance must be added to the scene using ``add_child()``.
202202
var mob_spawn_location = $MobPath/MobSpawnLocation
203203
mob_spawn_location.progress_ratio = randf()
204204

205+
# Set the mob's position to the random location.
206+
mob.position = mob_spawn_location.position
207+
205208
# Set the mob's direction perpendicular to the path direction.
206209
var direction = mob_spawn_location.rotation + PI / 2
207210

208-
# Set the mob's position to a random location.
209-
mob.position = mob_spawn_location.position
210-
211211
# Add some randomness to the direction.
212212
direction += randf_range(-PI / 4, PI / 4)
213213
mob.rotation = direction

0 commit comments

Comments
 (0)