diff options
Diffstat (limited to 'scenes/main.gd')
-rw-r--r-- | scenes/main.gd | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/scenes/main.gd b/scenes/main.gd index e48cff7..7c1b83b 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -1,7 +1,7 @@ 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: @@ -21,10 +21,20 @@ func _on_microgame_spawn_timer_timeout() -> void: if (randf() < 20.5): 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() - fishin_instance.win.connect(on_other_fishin_win) + 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") @@ -54,6 +64,7 @@ func _on_fishin_win(fish_caught: Fishin.FishType) -> void: $Clippette.start_dialogue() $"Score window (real)".visible = true + func _on_score_window_donezo() -> void: for child in get_children(): @@ -75,5 +86,10 @@ func _on_score_window_donezo() -> void: # This is the one for the fishing microgame that appears after the first one -func on_other_fishin_win(fish_caught: Fishin.FishType): - print(fish_caught) +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() |