From a472a321179268710722232ee61aa04b369c627c Mon Sep 17 00:00:00 2001 From: Zoey Kitt Date: Sat, 16 Nov 2024 19:38:06 -0600 Subject: Make the fishing minigame transition into stonks --- scenes/main.gd | 5 +++++ scenes/main.tscn | 6 +++--- scenes/microgames/fishin/fishin.gd | 13 +++++++++++-- scenes/microgames/fishin/node_2d.tscn | 4 ++++ scenes/stockticker/Stock Ticker.tscn | 1 - scenes/stockticker/transactions.gd | 4 ++++ 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/scenes/main.gd b/scenes/main.gd index 6949a8c..5349cf4 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -35,3 +35,8 @@ func _on_microgame_spawn_timer_timeout() -> void: func _on_microgame_win(window: MicrogameWindow): print("yay") + + +func _on_fishin_win() -> void: + $Fishin.visible = false + $"Stock ticker".start() diff --git a/scenes/main.tscn b/scenes/main.tscn index 1a7ded1..fa0bfb2 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -333,10 +333,10 @@ text = "Net worth: $00000000000000000000" +[node name="Stock ticker" parent="." instance=ExtResource("4_0ankd")] + [node name="Fishin" parent="." instance=ExtResource("10_sx2ad")] position = Vector2(0, 0) -[node name="Stock ticker" parent="." instance=ExtResource("4_0ankd")] -visible = false - [connection signal="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"] +[connection signal="win" from="Fishin" to="." method="_on_fishin_win"] diff --git a/scenes/microgames/fishin/fishin.gd b/scenes/microgames/fishin/fishin.gd index c6f62d9..6d53964 100644 --- a/scenes/microgames/fishin/fishin.gd +++ b/scenes/microgames/fishin/fishin.gd @@ -1,5 +1,7 @@ extends Node2D +signal win + const IN_GAME_WAIT_TIME = 10 var pulling: Sprite2D @@ -13,7 +15,9 @@ var shake2: ShakePivot var shake3: ShakePivot var start_game_timer: Timer var in_game_timer: Timer -var succfail_timer: Timer +# This used to mean "success/failure" but now means "you succ, failure" +var succfail_timer: Timer +var success_timer: Timer var in_minigame = false var num_clicks = 0 @@ -32,6 +36,7 @@ func _ready() -> void: start_game_timer = $StartGame in_game_timer = $InGame succfail_timer = $SuccessFail + success_timer = $Success # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -63,7 +68,7 @@ func _on_texture_button_button_up() -> void: in_game_timer.stop() in_game_timer.wait_time = IN_GAME_WAIT_TIME - succfail_timer.start() + success_timer.start() func _on_start_game_timeout() -> void: @@ -111,3 +116,7 @@ func _on_success_fail_timeout() -> void: you.visible = true succfail_timer.stop() start_game_timer.start() + + +func _on_success_timeout() -> void: + win.emit() diff --git a/scenes/microgames/fishin/node_2d.tscn b/scenes/microgames/fishin/node_2d.tscn index 932fb56..e98b040 100644 --- a/scenes/microgames/fishin/node_2d.tscn +++ b/scenes/microgames/fishin/node_2d.tscn @@ -137,7 +137,11 @@ text = "You caught GAR!" [node name="SuccessFail" type="Timer" parent="."] wait_time = 3.0 +[node name="Success" type="Timer" parent="."] +wait_time = 3.0 + [connection signal="button_up" from="TextureButton" to="." method="_on_texture_button_button_up"] [connection signal="timeout" from="StartGame" to="." method="_on_start_game_timeout"] [connection signal="timeout" from="InGame" to="." method="_on_in_game_timeout"] [connection signal="timeout" from="SuccessFail" to="." method="_on_success_fail_timeout"] +[connection signal="timeout" from="Success" to="." method="_on_success_timeout"] diff --git a/scenes/stockticker/Stock Ticker.tscn b/scenes/stockticker/Stock Ticker.tscn index ed94339..6afa1af 100644 --- a/scenes/stockticker/Stock Ticker.tscn +++ b/scenes/stockticker/Stock Ticker.tscn @@ -23,7 +23,6 @@ scale = Vector2(1280, 720) texture = ExtResource("1_wbfee") [node name="Timer" type="Timer" parent="."] -autostart = true [node name="Sprite2D" type="Sprite2D" parent="."] position = Vector2(1036, 555) diff --git a/scenes/stockticker/transactions.gd b/scenes/stockticker/transactions.gd index daff901..39e25b9 100644 --- a/scenes/stockticker/transactions.gd +++ b/scenes/stockticker/transactions.gd @@ -15,3 +15,7 @@ func _on_stonks_sell(amount: Variant) -> void: print("+$%s" % amount.toString()) sell.emit(amount) + +# Scope creep! +func start(): + $Timer.start() -- cgit v1.2.3