From 0f1b81588b2590e51fc6253f030eea68189a7b74 Mon Sep 17 00:00:00 2001 From: Zoey Kitt Date: Sun, 17 Nov 2024 14:06:00 -0600 Subject: Make the fishing minigame communicate the fish caught on win --- scenes/main.gd | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'scenes/main.gd') diff --git a/scenes/main.gd b/scenes/main.gd index 4600689..e48cff7 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] + + # Called when the node enters the scene tree for the first time. func _ready() -> void: pass @@ -13,13 +16,19 @@ 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() < 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) + + 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) @@ -37,7 +46,7 @@ func _on_microgame_win(window: MicrogameWindow): print("yay") -func _on_fishin_win() -> void: +func _on_fishin_win(fish_caught: Fishin.FishType) -> void: $Fishin.queue_free() $"Stock ticker".start() $"Microgame spawn timer".start() @@ -63,3 +72,8 @@ 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): + print(fish_caught) -- cgit v1.2.3