浏览代码

Merge pull request #901 from cbscribe/tutorial_fixes

Update tutorial to reflect PathFollow2D change
Chris Bradfield 8 年之前
父节点
当前提交
6fc87c5e96
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      learning/step_by_step/your_first_game.rst

+ 3 - 2
learning/step_by_step/your_first_game.rst

@@ -551,8 +551,9 @@ Note that a new instance must be added to the scene using
         # create a Mob instance and add it to the scene
         # create a Mob instance and add it to the scene
         var mob = Mob.instance()
         var mob = Mob.instance()
         add_child(mob)
         add_child(mob)
-        # choose a direction and position
-        var direction = $MobPath/MobSpawnLocation.rotation
+        # set the mob's direction perpendicular to the path direction
+        var direction = $MobPath/MobSpawnLocation.rotation + PI/2
+        # set the mob's position to the random location
         mob.position = $MobPath/MobSpawnLocation.position
         mob.position = $MobPath/MobSpawnLocation.position
         # add some randomness to the direction
         # add some randomness to the direction
         direction += rand_range(-PI/4, PI/4)
         direction += rand_range(-PI/4, PI/4)