summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scenes/main.gd36
-rw-r--r--scenes/main.tscn25
-rw-r--r--scenes/microgames/ad_window.gd20
-rw-r--r--scenes/microgames/ad_window.tscn7
-rw-r--r--scenes/microgames/microgame_window.gd (renamed from scenes/closable_window.gd)4
-rw-r--r--scenes/microgames/microgame_window.tscn14
-rw-r--r--scenes/microgames/window_mvp.tscn (renamed from scenes/window_mvp.tscn)0
-rw-r--r--scenes/window_mvp2.tscn14
8 files changed, 93 insertions, 27 deletions
diff --git a/scenes/main.gd b/scenes/main.gd
new file mode 100644
index 0000000..7d89108
--- /dev/null
+++ b/scenes/main.gd
@@ -0,0 +1,36 @@
+extends Node2D
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready() -> void:
+ _on_microgame_spawn_timer_timeout()
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+func _process(delta: float) -> void:
+ pass
+
+
+func _on_microgame_spawn_timer_timeout() -> void:
+ print("WAAAHAHAHA MICROGAMES")
+
+ # Spawn a microgame window
+ var window_scene = preload("res://scenes/microgames/ad_window.tscn")
+ var window_instance = window_scene.instantiate()
+ add_child(window_instance)
+ var microgame_scene = preload("res://scenes/microgames/window_mvp.tscn")
+ var microgame_instance = microgame_scene.instantiate()
+ window_instance.add_child(microgame_instance)
+
+ # Randomize window position
+ var screen_size = DisplayServer.screen_get_size()
+ var window_x = randi_range(0, screen_size.x - window_instance.size.x)
+ var window_y = randi_range(0, screen_size.y - window_instance.size.y)
+ window_instance.position = Vector2(window_x, window_y)
+
+ # Connect signals
+ window_instance.win.connect(_on_microgame_win)
+
+
+func _on_microgame_win(window: MicrogameWindow):
+ print("yay")
diff --git a/scenes/main.tscn b/scenes/main.tscn
index 5a4640f..32b0540 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -1,25 +1,24 @@
-[gd_scene load_steps=4 format=3 uid="uid://d06d1vihf2oqp"]
+[gd_scene load_steps=3 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/closable_window.gd" id="2_2mdl3"]
-[ext_resource type="PackedScene" uid="uid://baukkysebggup" path="res://scenes/window_mvp.tscn" id="2_ls66h"]
+[ext_resource type="Script" path="res://scenes/main.gd" id="1_y7a0r"]
[node name="Node2D" type="Node2D"]
+script = ExtResource("1_y7a0r")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(636.307, 381.672)
scale = Vector2(0.293995, 0.217148)
texture = ExtResource("1_o2s48")
-[node name="Window" type="Window" parent="."]
-title = "hiiiii"
-position = Vector2i(1710, 1112)
-size = Vector2i(1280, 720)
-content_scale_size = Vector2i(1280, 720)
-content_scale_mode = 1
-content_scale_aspect = 1
-script = ExtResource("2_2mdl3")
+[node name="Score" type="Label" parent="."]
+offset_top = 2.0
+offset_right = 83.0
+offset_bottom = 25.0
+text = "Net worth: $"
-[node name="WindowMvp" parent="Window" instance=ExtResource("2_ls66h")]
+[node name="Microgame spawn timer" type="Timer" parent="."]
+wait_time = 10.0
+autostart = true
-[connection signal="close_requested" from="Window" to="Window" method="_on_close_requested"]
+[connection signal="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"]
diff --git a/scenes/microgames/ad_window.gd b/scenes/microgames/ad_window.gd
new file mode 100644
index 0000000..2662642
--- /dev/null
+++ b/scenes/microgames/ad_window.gd
@@ -0,0 +1,20 @@
+extends "res://scenes/microgames/microgame_window.gd"
+
+
+## A simple microgame that you win by closing the window
+
+
+# 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
+
+
+func _on_close_requested() -> void:
+ super()
+ print("Hmm perchance")
+ win.emit(self)
diff --git a/scenes/microgames/ad_window.tscn b/scenes/microgames/ad_window.tscn
new file mode 100644
index 0000000..8ae397c
--- /dev/null
+++ b/scenes/microgames/ad_window.tscn
@@ -0,0 +1,7 @@
+[gd_scene load_steps=3 format=3 uid="uid://ccbxoes40rtkj"]
+
+[ext_resource type="PackedScene" uid="uid://b2awdq32lxnef" path="res://scenes/microgames/microgame_window.tscn" id="1_ogoum"]
+[ext_resource type="Script" path="res://scenes/microgames/ad_window.gd" id="2_3vqme"]
+
+[node name="Window" instance=ExtResource("1_ogoum")]
+script = ExtResource("2_3vqme")
diff --git a/scenes/closable_window.gd b/scenes/microgames/microgame_window.gd
index 97e1e03..40d3d63 100644
--- a/scenes/closable_window.gd
+++ b/scenes/microgames/microgame_window.gd
@@ -1,4 +1,8 @@
extends Window
+class_name MicrogameWindow
+
+
+signal win(this: MicrogameWindow)
func _on_close_requested() -> void:
diff --git a/scenes/microgames/microgame_window.tscn b/scenes/microgames/microgame_window.tscn
new file mode 100644
index 0000000..17f30aa
--- /dev/null
+++ b/scenes/microgames/microgame_window.tscn
@@ -0,0 +1,14 @@
+[gd_scene load_steps=2 format=3 uid="uid://b2awdq32lxnef"]
+
+[ext_resource type="Script" path="res://scenes/microgames/microgame_window.gd" id="1_8ce8l"]
+
+[node name="Window" type="Window"]
+auto_translate_mode = 1
+title = "hiiiii"
+size = Vector2i(1280, 720)
+content_scale_size = Vector2i(1280, 720)
+content_scale_mode = 1
+content_scale_aspect = 1
+script = ExtResource("1_8ce8l")
+
+[connection signal="close_requested" from="." to="." method="_on_close_requested"]
diff --git a/scenes/window_mvp.tscn b/scenes/microgames/window_mvp.tscn
index da707d8..da707d8 100644
--- a/scenes/window_mvp.tscn
+++ b/scenes/microgames/window_mvp.tscn
diff --git a/scenes/window_mvp2.tscn b/scenes/window_mvp2.tscn
deleted file mode 100644
index 08b5b59..0000000
--- a/scenes/window_mvp2.tscn
+++ /dev/null
@@ -1,14 +0,0 @@
-[gd_scene load_steps=2 format=3 uid="uid://dtp5im4xmo5lh"]
-
-[ext_resource type="Texture2D" uid="uid://ckb8ord5slhwf" path="res://taytay/IMG_5428.jpeg" id="1_u7ueo"]
-
-[node name="WindowMvp2" type="Window"]
-size = Vector2i(700, 700)
-
-[node name="Sprite2D2" type="Sprite2D" parent="."]
-
-[node name="Sprite2D" type="Sprite2D" parent="Sprite2D2"]
-position = Vector2(400, 400)
-rotation = 1.5708
-scale = Vector2(0.14, 0.14)
-texture = ExtResource("1_u7ueo")