Skip to content

Commit

Permalink
now actually better randomization
Browse files Browse the repository at this point in the history
  • Loading branch information
singerbj committed Apr 28, 2024
1 parent ec56a18 commit 3a5cb58
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand All @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 3a5cb58

Please sign in to comment.