From 8ccae5aad9d896d3ec4a4684c30ae35f14794569 Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Sun, 17 Nov 2024 14:46:56 -0600 Subject: add losing money --- scenes/main.gd | 11 +++++++++++ scenes/main.tscn | 6 +++++- scenes/microgames/ad/ad_window.gd | 8 +++++++- scenes/microgames/ad/ad_window.tscn | 4 ++++ scenes/microgames/fishin/fishin.gd | 2 ++ scenes/microgames/microgame_window.gd | 2 ++ scenes/score_window/score_window.gd | 2 +- scenes/title.gd | 2 ++ 8 files changed, 34 insertions(+), 3 deletions(-) (limited to 'scenes') diff --git a/scenes/main.gd b/scenes/main.gd index bfee6d1..496edcc 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -31,10 +31,20 @@ func _on_microgame_spawn_timer_timeout() -> void: # Connect signals window_instance.win.connect(_on_microgame_win) + window_instance.lose.connect(_on_microgame_lose) + window_instance.ad_open.connect(_on_ad_open) + $"Score window (real)/Score window".net_worth.timesEquals(0.9) + +func _on_ad_open(window: MicrogameWindow): + $"Score window (real)/Score window".net_worth.timesEquals(0.95) func _on_microgame_win(window: MicrogameWindow): print("yay") + +func _on_microgame_lose(window: MicrogameWindow): + print("noooooo") + $"Score window (real)/Score window".net_worth.timesEquals(0.8) func _on_fishin_win() -> void: @@ -44,6 +54,7 @@ func _on_fishin_win() -> void: $Clippette.visible = true $Clippette.start_dialogue() $"Score window (real)".visible = true + $AudioStreamPlayer.play() func _on_score_window_donezo() -> void: diff --git a/scenes/main.tscn b/scenes/main.tscn index c805906..4b71867 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=50 format=3 uid="uid://d06d1vihf2oqp"] +[gd_scene load_steps=51 format=3 uid="uid://d06d1vihf2oqp"] [ext_resource type="Texture2D" uid="uid://b03ygtrwha22g" path="res://taytay/IMG_5199.jpeg" id="1_o2s48"] [ext_resource type="Script" path="res://scenes/main.gd" id="1_y7a0r"] @@ -10,6 +10,7 @@ [ext_resource type="Script" path="res://scenes/score_window/score_window.gd" id="6_gvoxs"] [ext_resource type="Texture2D" uid="uid://dohsqvvi8y64h" path="res://UI/fish-spinning-ezgif.com-gif-to-sprite-converter.png" id="8_oj2tc"] [ext_resource type="PackedScene" uid="uid://c4s4pigu4pr48" path="res://scenes/microgames/fishin/node_2d.tscn" id="10_sx2ad"] +[ext_resource type="AudioStream" uid="uid://di3mxkflh6a3o" path="res://funny_sounds/gamblecore.mp3" id="11_33353"] [sub_resource type="AtlasTexture" id="AtlasTexture_uyge7"] atlas = ExtResource("8_oj2tc") @@ -339,6 +340,9 @@ $00000000000000000000" position = Vector2(0, 0) scale = Vector2(1, 1) +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("11_33353") + [connection signal="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"] [connection signal="donezo" from="Score window (real)/Score window" to="." method="_on_score_window_donezo"] [connection signal="buy" from="Stock ticker" to="Score window (real)/Score window" method="_on_stock_ticker_buy"] diff --git a/scenes/microgames/ad/ad_window.gd b/scenes/microgames/ad/ad_window.gd index 3e3fc33..88111a9 100644 --- a/scenes/microgames/ad/ad_window.gd +++ b/scenes/microgames/ad/ad_window.gd @@ -6,6 +6,7 @@ extends "res://scenes/microgames/microgame_window.gd" # Called when the node enters the scene tree for the first time. func _ready() -> void: + # Choose a random ad var all_ads := $"All ads" var sprite := all_ads.get_children().pick_random() as Sprite2D @@ -20,7 +21,6 @@ func _ready() -> void: float(window_size.y) / float(sprite.texture.get_height()) ) - # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass @@ -34,3 +34,9 @@ func _on_close_requested() -> void: func _on_texture_button_pressed() -> void: OS.shell_open("https://www.youtube.com/watch?v=dQw4w9WgXcQ") + lose.emit(self) + + + +func _on_timer_timeout() -> void: + ad_open.emit(self) diff --git a/scenes/microgames/ad/ad_window.tscn b/scenes/microgames/ad/ad_window.tscn index 7c98b6e..dd89a93 100644 --- a/scenes/microgames/ad/ad_window.tscn +++ b/scenes/microgames/ad/ad_window.tscn @@ -110,4 +110,8 @@ texture = ExtResource("25_o5yc3") offset_right = 1000.0 offset_bottom = 1000.0 +[node name="Timer" type="Timer" parent="." index="2"] +autostart = true + [connection signal="pressed" from="TextureButton" to="." method="_on_texture_button_pressed"] +[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/scenes/microgames/fishin/fishin.gd b/scenes/microgames/fishin/fishin.gd index abaf999..1aa911c 100644 --- a/scenes/microgames/fishin/fishin.gd +++ b/scenes/microgames/fishin/fishin.gd @@ -13,6 +13,7 @@ enum FishType { } signal win +signal lose const IN_GAME_WAIT_TIME = 10 @@ -170,6 +171,7 @@ func _on_in_game_timeout() -> void: $"Fart".play() get_window().title = "🙂👎" + lose.emit() func _on_success_fail_timeout() -> void: diff --git a/scenes/microgames/microgame_window.gd b/scenes/microgames/microgame_window.gd index 40d3d63..5b44f23 100644 --- a/scenes/microgames/microgame_window.gd +++ b/scenes/microgames/microgame_window.gd @@ -3,6 +3,8 @@ class_name MicrogameWindow signal win(this: MicrogameWindow) +signal lose(this: MicrogameWindow) +signal ad_open(this: MicrogameWindow) func _on_close_requested() -> void: diff --git a/scenes/score_window/score_window.gd b/scenes/score_window/score_window.gd index 76fb983..d6c465d 100644 --- a/scenes/score_window/score_window.gd +++ b/scenes/score_window/score_window.gd @@ -17,7 +17,7 @@ func _ready() -> void: func _process(delta: float) -> void: $Score.text = "Net worth: \n$%s" % net_worth.toString() - if net_worth.isLessThan(Big.new(0)): + if net_worth.isLessThan(Big.new(0)) or net_worth.toString()[0] == '-': donezo.emit() diff --git a/scenes/title.gd b/scenes/title.gd index d5c2159..afb1b34 100644 --- a/scenes/title.gd +++ b/scenes/title.gd @@ -23,6 +23,8 @@ func _on_minimize_button_up() -> void: func _on_start_pressed() -> void: #get_window().size = Vector2(0,0) This messes up the text for some godforesaken reason get_window().position = Vector2(-1000,-1000) + var audio = $AudioStreamPlayer + audio.stop() var new_window = Window.new() new_window.size = Vector2i(1280, 720) -- cgit v1.2.3