From 634ab34a4cc90d470e9e163a3c427aea57db1339 Mon Sep 17 00:00:00 2001 From: Peter DV <55121683+greenmoggle@users.noreply.github.com> Date: Thu, 24 Sep 2020 18:13:04 +1000 Subject: [PATCH] Removed GD namespace from RandRange `GD.RandRange` was returning a double where a float was expected causing a type error. Using the `RandRange` function as described in the tutorial fixes the error. --- getting_started/step_by_step/your_first_game.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting_started/step_by_step/your_first_game.rst b/getting_started/step_by_step/your_first_game.rst index 119312456..082824f33 100644 --- a/getting_started/step_by_step/your_first_game.rst +++ b/getting_started/step_by_step/your_first_game.rst @@ -898,11 +898,11 @@ Note that a new instance must be added to the scene using ``add_child()``. mobInstance.Position = mobSpawnLocation.Position; // Add some randomness to the direction. - direction += GD.RandRange(-Mathf.Pi / 4, Mathf.Pi / 4); + direction += RandRange(-Mathf.Pi / 4, Mathf.Pi / 4); mobInstance.Rotation = direction; // Choose the velocity. - mobInstance.LinearVelocity = new Vector2(GD.RandRange(150f, 250f), 0).Rotated(direction); + mobInstance.LinearVelocity = new Vector2(RandRange(150f, 250f), 0).Rotated(direction); } .. important:: Why ``PI``? In functions requiring angles, GDScript uses *radians*,