From 3a5cb5857d30c146e6b78492a8819e39e70b47a8 Mon Sep 17 00:00:00 2001 From: Benjamin Singer Date: Sun, 28 Apr 2024 09:18:39 -0500 Subject: [PATCH] now actually better randomization --- scripts/game.gd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/game.gd b/scripts/game.gd index 71bff7d..a017ba4 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -26,7 +26,7 @@ var last_game_objects = [] var last_pause = 0 var points = 0 var game_object_scenes = GAME_OBJECT_SCENES.duplicate() -var first_game_object +var last_game_object : PackedScene var game_objects = [] @@ -42,7 +42,7 @@ var current_game_state = GameState.Paused func _ready() -> void: get_parent().get_node("CanvasLayer").hide() game_object_scenes.shuffle() - first_game_object = game_object_scenes[0] + last_game_object = game_object_scenes[game_object_scenes.size() - 1] func _process(_delta: float) -> void: var current_time = Time.get_unix_time_from_system() @@ -65,9 +65,9 @@ func _process(_delta: float) -> void: last_game_objects = [] game_object_scenes = GAME_OBJECT_SCENES.duplicate() game_object_scenes.shuffle() - while game_object_scenes[0] != first_game_object: + while game_object_scenes[0] == last_game_object: game_object_scenes.shuffle() - first_game_object = game_object_scenes[0] + last_game_object = game_object_scenes[game_object_scenes.size() - 1] while last_game_objects.has(new_last_game_object): new_last_game_object += 1