diff options
author | Zoey Kitt <zoey.kitt@outlook.com> | 2024-11-17 14:06:00 -0600 |
---|---|---|
committer | Zoey Kitt <zoey.kitt@outlook.com> | 2024-11-17 14:06:00 -0600 |
commit | 0f1b81588b2590e51fc6253f030eea68189a7b74 (patch) | |
tree | 1d19dadb8fc43efc738ab7686713ca69ca2d6a5d /scenes | |
parent | 88172d8807b560fb4fec794c3b32015d9e48a159 (diff) |
Make the fishing minigame communicate the fish caught on win
Diffstat (limited to 'scenes')
-rw-r--r-- | scenes/main.gd | 28 | ||||
-rw-r--r-- | scenes/microgames/fishin/fishin.gd | 8 |
2 files changed, 26 insertions, 10 deletions
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) diff --git a/scenes/microgames/fishin/fishin.gd b/scenes/microgames/fishin/fishin.gd index 7064bee..fdae7d1 100644 --- a/scenes/microgames/fishin/fishin.gd +++ b/scenes/microgames/fishin/fishin.gd @@ -1,4 +1,5 @@ extends Node2D +class_name Fishin enum FishType { GAR, @@ -12,7 +13,7 @@ enum FishType { LEAPING_SMACKEREL, } -signal win +signal win(fish_type: FishType) signal fish_chosen(fish_sprite: Sprite2D, fish_name: String) const IN_GAME_WAIT_TIME = 10 @@ -32,6 +33,7 @@ var in_game_timer: Timer var succfail_timer: Timer var success_timer: Timer +var fish_choice var gar var salmon var bass @@ -106,7 +108,7 @@ func _on_texture_button_button_up() -> void: happy.visible = true # show fish - var fish_choice: FishType = randi_range(0,len(fishes)) + fish_choice = randi_range(0,len(fishes)) fish_choice = FishType.MOBY_DICK @@ -223,4 +225,4 @@ func _on_success_fail_timeout() -> void: func _on_success_timeout() -> void: - win.emit() + win.emit(fish_choice) |