diff options
Diffstat (limited to 'game/main.gd')
-rw-r--r-- | game/main.gd | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/game/main.gd b/game/main.gd index 68f2d3c..4c20e5a 100644 --- a/game/main.gd +++ b/game/main.gd @@ -1,6 +1,10 @@ extends Node2D -const MICROGAMES = [preload("res://game/microgames/flowers_delivery/flowers_delivery.tscn")] +var MICROGAMES = [ + preload("res://game/microgames/flowers_delivery/flowers_delivery.tscn"), + preload("res://game/microgames/heart_break/heart_break.tscn"), + preload("res://game/microgames/find_window/find_window.tscn"), + ] @onready var transition: Transition = %Transition @onready var microgame_viewport = %MicrogameViewport @@ -11,9 +15,14 @@ var _current_microgame: Microgame var _starting = true var _won_last_microgame = false var _microgame_count = 1 +var _microgame_idx = 0 func _ready() -> void: + randomize() + + MICROGAMES.shuffle() + %FadeAnimationPlayer.play("fade_in") transition.reset() transition.microgame_fade_out() @@ -33,7 +42,11 @@ func _ready() -> void: await transition.play_result_animation(_won_last_microgame) - _current_microgame = MICROGAMES[0].instantiate() + _current_microgame = MICROGAMES[_microgame_idx].instantiate() + _microgame_idx = (_microgame_idx + 1) % MICROGAMES.size() + if _microgame_idx == 0: + MICROGAMES.shuffle() + microgame_subviewport.add_child(_current_microgame) _current_microgame.process_mode = Node.PROCESS_MODE_DISABLED @@ -46,7 +59,8 @@ func _ready() -> void: _won_last_microgame = await _current_microgame.finished _current_microgame.process_mode = Node.PROCESS_MODE_DISABLED - await get_tree().create_timer(1.0).timeout + await get_tree().create_timer(0.5).timeout _starting = false _microgame_count += 1 + Engine.time_scale = 1 + (_microgame_count * 0.05) |