diff options
Diffstat (limited to 'scenes/main.gd')
-rw-r--r-- | scenes/main.gd | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/scenes/main.gd b/scenes/main.gd index d128e3f..8fe50aa 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -1,5 +1,8 @@ extends Node2D +var fishes = [Fishin.FishType.GAR, Fishin.FishType.SALMON, Fishin.FishType.BASS, Fishin.FishType.HUMUHUMUNUKUNUKUAPUA_A, Fishin.FishType.CATFSIH, Fishin.FishType.DOGFISH, Fishin.FishType.ANGLERFISH, Fishin.FishType.MOBY_DICK, Fishin.FishType.LEAPING_SMACKEREL] +var fish_seen: Array + # Called when the node enters the scene tree for the first time. func _ready() -> void: pass @@ -13,13 +16,29 @@ func _process(delta: float) -> void: func _on_microgame_spawn_timer_timeout() -> void: - print("WAAAHAHAHA MICROGAMES") - # Spawn a microgame window - var window_scene = preload("res://scenes/microgames/ad/ad_window.tscn") - var window_instance = window_scene.instantiate() - - print(type_string(typeof(window_instance))) + var window_instance = null + if (randf() < 0.25): + var window_scene = preload("res://scenes/microgames/microgame_window.tscn") + window_instance = window_scene.instantiate() + + var fishin_scene = preload("res://scenes/microgames/fishin/node_2d.tscn") + var fishin_instance = fishin_scene.instantiate() + + var stonk_scene = preload("res://scenes/stockticker/Stock Ticker.tscn") + var stonk_instance = stonk_scene.instantiate() + + stonk_instance.buy.connect($"Score window (real)/Score window"._on_stock_ticker_buy) + stonk_instance.sell.connect($"Score window (real)/Score window"._on_stock_ticker_sell) + + fishin_instance.fish_chosen.connect(stonk_instance._on_fishin_fish_chosen) + fishin_instance.win.connect(on_other_fishin_win.bind(fishin_instance, stonk_instance, window_instance)) + + window_instance.add_child(stonk_instance) + window_instance.add_child(fishin_instance) + else: + var window_scene = preload("res://scenes/microgames/ad/ad_window.tscn") + window_instance = window_scene.instantiate() add_child(window_instance) @@ -48,15 +67,15 @@ func _on_microgame_lose(window: MicrogameWindow): $"Score window (real)/Score window".net_worth.timesEquals(0.8) -func _on_fishin_win() -> void: +func _on_fishin_win(fish_caught: Fishin.FishType) -> void: $Fishin.queue_free() $"Stock ticker".start() - $"Microgame spawn timer".start() $Clippette.visible = true $Clippette.start_dialogue() $"Score window (real)".visible = true + fish_seen.push_back(fish_caught) $Music.play() - + func _on_score_window_donezo() -> void: for child in get_children(): @@ -77,3 +96,18 @@ func _on_score_window_donezo() -> void: var gameover_scene_instance = gameover_scene.instantiate() new_window.add_child(gameover_scene_instance) add_child(new_window) + + +# This is the one for the fishing microgame that appears after the first one +func on_other_fishin_win(fish_caught: Fishin.FishType, fishin: Fishin, stonk, window: Window): + if not (fish_caught in fish_seen): + fish_seen.push_back(fish_caught) + fishin.queue_free() + stonk.start() + else: + window.queue_free() + + +func _on_clippette_intro_finished() -> void: + _on_microgame_spawn_timer_timeout() + $"Microgame spawn timer".start() |