summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scenes/main.gd8
-rw-r--r--scenes/main.tscn9
-rw-r--r--scenes/stockticker/transactions.gd14
3 files changed, 21 insertions, 10 deletions
diff --git a/scenes/main.gd b/scenes/main.gd
index e5dedb8..53da549 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -1,9 +1,11 @@
extends Node2D
+var net_worth: Big
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
_on_microgame_spawn_timer_timeout()
+ net_worth = Big.new(1000)
# Called every frame. 'delta' is the elapsed time since the previous frame.
@@ -11,6 +13,8 @@ func _process(delta: float) -> void:
# The most important functionality
if Input.is_action_just_pressed("G"):
$Meow.play()
+
+ $Score.text = "Net worth: $%s" % net_worth.toString()
func _on_microgame_spawn_timer_timeout() -> void:
@@ -33,3 +37,7 @@ func _on_microgame_spawn_timer_timeout() -> void:
func _on_microgame_win(window: MicrogameWindow):
print("yay")
+
+
+func _on_stock_ticker_buy(amount: Variant) -> void:
+ net_worth = net_worth.minus(amount)
diff --git a/scenes/main.tscn b/scenes/main.tscn
index df18da3..7156bd7 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=4 format=3 uid="uid://d06d1vihf2oqp"]
+[gd_scene load_steps=5 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"]
[ext_resource type="AudioStream" uid="uid://wtoxhk0tf8ev" path="res://funny_sounds/Cat Meow - Minecraft Sound Effect (HD).mp3" id="3_gatxj"]
+[ext_resource type="PackedScene" uid="uid://g2veoq55y14i" path="res://scenes/stockticker/Stock Ticker.tscn" id="4_0ankd"]
[node name="Node2D2" type="Node2D"]
script = ExtResource("1_y7a0r")
@@ -25,4 +26,10 @@ autostart = true
[node name="Meow" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_gatxj")
+[node name="Window" type="Window" parent="."]
+size = Vector2i(1280, 720)
+
+[node name="Stock ticker" parent="Window" instance=ExtResource("4_0ankd")]
+
[connection signal="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"]
+[connection signal="buy" from="Window/Stock ticker" to="." method="_on_stock_ticker_buy"]
diff --git a/scenes/stockticker/transactions.gd b/scenes/stockticker/transactions.gd
index c90e473..daff901 100644
--- a/scenes/stockticker/transactions.gd
+++ b/scenes/stockticker/transactions.gd
@@ -3,19 +3,15 @@ extends Node2D
## I need the signal-emitter to be the root node of this scene and when I
## tried to just move the script it broke the stonk line so here this is I guess lol
-# Called when the node enters the scene tree for the first time.
-func _ready() -> void:
- pass # Replace with function body.
-
-
-# Called every frame. 'delta' is the elapsed time since the previous frame.
-func _process(delta: float) -> void:
- pass
-
+signal buy(amount: Variant)
+signal sell(amount: Variant)
func _on_stonks_buy(amount: Variant) -> void:
print("-$%s" % amount.toString())
+ buy.emit(amount)
func _on_stonks_sell(amount: Variant) -> void:
print("+$%s" % amount.toString())
+ sell.emit(amount)
+