mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Merge pull request #4062 from greenmoggle/master
Removed GD namespace from RandRange
This commit is contained in:
@@ -898,11 +898,11 @@ Note that a new instance must be added to the scene using ``add_child()``.
|
|||||||
mobInstance.Position = mobSpawnLocation.Position;
|
mobInstance.Position = mobSpawnLocation.Position;
|
||||||
|
|
||||||
// Add some randomness to the direction.
|
// 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;
|
mobInstance.Rotation = direction;
|
||||||
|
|
||||||
// Choose the velocity.
|
// 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*,
|
.. important:: Why ``PI``? In functions requiring angles, GDScript uses *radians*,
|
||||||
|
|||||||
Reference in New Issue
Block a user