Skip to content

Commit 514956a

Browse files
authored
Merge pull request #6855 from abduelhamit/patch-1
Fix: progress_ratio expects a float, not an int
2 parents 638522c + 58bf7ed commit 514956a

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
@@ -311,7 +311,7 @@ Note that a new instance must be added to the scene using ``add_child()``.
311311

312312
# Choose a random location on Path2D.
313313
var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
314-
mob_spawn_location.progress_ratio = randi()
314+
mob_spawn_location.progress_ratio = randf()
315315

316316
# Set the mob's direction perpendicular to the path direction.
317317
var direction = mob_spawn_location.rotation + PI / 2
@@ -343,7 +343,7 @@ Note that a new instance must be added to the scene using ``add_child()``.
343343

344344
// Choose a random location on Path2D.
345345
var mobSpawnLocation = GetNode<PathFollow2D>("MobPath/MobSpawnLocation");
346-
mobSpawnLocation.ProgressRatio = GD.Randi();
346+
mobSpawnLocation.ProgressRatio = GD.Randf();
347347

348348
// Set the mob's direction perpendicular to the path direction.
349349
float direction = mobSpawnLocation.Rotation + Mathf.Pi / 2;
@@ -371,7 +371,7 @@ Note that a new instance must be added to the scene using ``add_child()``.
371371
godot::Node *mob = mob_scene->instance();
372372
373373
// Choose a random location on Path2D.
374-
_mob_spawn_location->set_progress_ratio((real_t)_random->randi());
374+
_mob_spawn_location->set_progress_ratio((real_t)_random->randf());
375375

376376
// Set the mob's direction perpendicular to the path direction.
377377
real_t direction = _mob_spawn_location->get_rotation() + (real_t)Math_PI / 2;

0 commit comments

Comments
 (0)