Make the fishing minigame transition into stonks

This commit is contained in:
Zoey Kitt 2024-11-16 19:38:06 -06:00
parent 162f6ba656
commit a472a32117
6 changed files with 27 additions and 6 deletions

View file

@ -35,3 +35,8 @@ func _on_microgame_spawn_timer_timeout() -> void:
func _on_microgame_win(window: MicrogameWindow): func _on_microgame_win(window: MicrogameWindow):
print("yay") print("yay")
func _on_fishin_win() -> void:
$Fishin.visible = false
$"Stock ticker".start()

View file

@ -333,10 +333,10 @@ text = "Net worth:
$00000000000000000000" $00000000000000000000"
[node name="Stock ticker" parent="." instance=ExtResource("4_0ankd")]
[node name="Fishin" parent="." instance=ExtResource("10_sx2ad")] [node name="Fishin" parent="." instance=ExtResource("10_sx2ad")]
position = Vector2(0, 0) 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="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"]
[connection signal="win" from="Fishin" to="." method="_on_fishin_win"]

View file

@ -1,5 +1,7 @@
extends Node2D extends Node2D
signal win
const IN_GAME_WAIT_TIME = 10 const IN_GAME_WAIT_TIME = 10
var pulling: Sprite2D var pulling: Sprite2D
@ -13,7 +15,9 @@ var shake2: ShakePivot
var shake3: ShakePivot var shake3: ShakePivot
var start_game_timer: Timer var start_game_timer: Timer
var in_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 in_minigame = false
var num_clicks = 0 var num_clicks = 0
@ -32,6 +36,7 @@ func _ready() -> void:
start_game_timer = $StartGame start_game_timer = $StartGame
in_game_timer = $InGame in_game_timer = $InGame
succfail_timer = $SuccessFail succfail_timer = $SuccessFail
success_timer = $Success
# Called every frame. 'delta' is the elapsed time since the previous frame. # 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.stop()
in_game_timer.wait_time = IN_GAME_WAIT_TIME in_game_timer.wait_time = IN_GAME_WAIT_TIME
succfail_timer.start() success_timer.start()
func _on_start_game_timeout() -> void: func _on_start_game_timeout() -> void:
@ -111,3 +116,7 @@ func _on_success_fail_timeout() -> void:
you.visible = true you.visible = true
succfail_timer.stop() succfail_timer.stop()
start_game_timer.start() start_game_timer.start()
func _on_success_timeout() -> void:
win.emit()

View file

@ -137,7 +137,11 @@ text = "You caught GAR!"
[node name="SuccessFail" type="Timer" parent="."] [node name="SuccessFail" type="Timer" parent="."]
wait_time = 3.0 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="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="StartGame" to="." method="_on_start_game_timeout"]
[connection signal="timeout" from="InGame" to="." method="_on_in_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="SuccessFail" to="." method="_on_success_fail_timeout"]
[connection signal="timeout" from="Success" to="." method="_on_success_timeout"]

View file

@ -23,7 +23,6 @@ scale = Vector2(1280, 720)
texture = ExtResource("1_wbfee") texture = ExtResource("1_wbfee")
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
autostart = true
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(1036, 555) position = Vector2(1036, 555)

View file

@ -15,3 +15,7 @@ func _on_stonks_sell(amount: Variant) -> void:
print("+$%s" % amount.toString()) print("+$%s" % amount.toString())
sell.emit(amount) sell.emit(amount)
# Scope creep!
func start():
$Timer.start()