diff options
author | Zoey Kitt <zoey.kitt@outlook.com> | 2024-11-16 13:16:05 -0600 |
---|---|---|
committer | Zoey Kitt <zoey.kitt@outlook.com> | 2024-11-16 13:16:05 -0600 |
commit | abf562ee7d7d7deb81e1e40c6710f1b11b077324 (patch) | |
tree | 72dc0456ba2aa13efe81980629d726aa77194ec0 /scenes | |
parent | 606c1714c654cb247a70c23b335a0aeca91c4c52 (diff) |
Add transaction signal
Diffstat (limited to 'scenes')
-rw-r--r-- | scenes/main.tscn | 2 | ||||
-rw-r--r-- | scenes/stockticker/stonks.gd | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/scenes/main.tscn b/scenes/main.tscn index 3dd15c9..df18da3 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -4,7 +4,7 @@ [ext_resource type="Script" path="res://scenes/main.gd" id="1_y7a0r"] [ext_resource type="AudioStream" uid="uid://wtoxhk0tf8ev" path="res://funny_sounds/Cat Meow - Minecraft Sound Effect (HD).mp3" id="3_gatxj"] -[node name="Node2D" type="Node2D"] +[node name="Node2D2" type="Node2D"] script = ExtResource("1_y7a0r") [node name="Sprite2D" type="Sprite2D" parent="."] diff --git a/scenes/stockticker/stonks.gd b/scenes/stockticker/stonks.gd index 508fb82..96ea000 100644 --- a/scenes/stockticker/stonks.gd +++ b/scenes/stockticker/stonks.gd @@ -1,5 +1,7 @@ extends Node2D +signal transaction(amount: float) + const MAX_PRICES = 15 const Y_START = 60 @@ -158,6 +160,7 @@ func _on_buy_button_button_up() -> void: shares += 1 shares_label.text = "Shares\nHeld:%d" % shares hype_mult += hype_inc + transaction.emit(-prev_price) func _on_sell_button_button_up() -> void: @@ -165,3 +168,4 @@ func _on_sell_button_button_up() -> void: shares -= 1 shares_label.text = "Shares\nHeld:%d" % shares panic_mult += panic_inc + transaction.emit(prev_price) |