summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoey Kitt <zoey.kitt@outlook.com>2024-11-15 19:53:02 -0600
committerZoey Kitt <zoey.kitt@outlook.com>2024-11-15 19:53:02 -0600
commit56377b3afac7d5809738c6016981c5153a20f2b3 (patch)
treef160b73658f0d2cb722e554fe10d45949257c8e3
parentb62bbaac0dd22ba130832292f9248de2e9aa4662 (diff)
Make derived window class for the ad microgame
-rw-r--r--scenes/main.gd7
-rw-r--r--scenes/main.tscn1
-rw-r--r--scenes/microgames/ad_window.gd19
-rw-r--r--scenes/microgames/ad_window.tscn7
-rw-r--r--scenes/microgames/microgame_window.gd1
5 files changed, 32 insertions, 3 deletions
diff --git a/scenes/main.gd b/scenes/main.gd
index 5214f25..ffad7e5 100644
--- a/scenes/main.gd
+++ b/scenes/main.gd
@@ -3,7 +3,7 @@ extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
- pass # Replace with function body.
+ _on_microgame_spawn_timer_timeout()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@@ -15,7 +15,7 @@ func _on_microgame_spawn_timer_timeout() -> void:
print("WAAAHAHAHA MICROGAMES")
# Spawn a microgame window
- var window_scene = preload("res://scenes/microgames/microgame_window.tscn")
+ 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")
@@ -27,3 +27,6 @@ func _on_microgame_spawn_timer_timeout() -> void:
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
+
diff --git a/scenes/main.tscn b/scenes/main.tscn
index 09d1a86..32b0540 100644
--- a/scenes/main.tscn
+++ b/scenes/main.tscn
@@ -18,6 +18,7 @@ offset_bottom = 25.0
text = "Net worth: $"
[node name="Microgame spawn timer" type="Timer" parent="."]
+wait_time = 10.0
autostart = true
[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..516af44
--- /dev/null
+++ b/scenes/microgames/ad_window.gd
@@ -0,0 +1,19 @@
+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")
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/microgames/microgame_window.gd b/scenes/microgames/microgame_window.gd
index 97e1e03..6d1adba 100644
--- a/scenes/microgames/microgame_window.gd
+++ b/scenes/microgames/microgame_window.gd
@@ -1,5 +1,4 @@
extends Window
-
func _on_close_requested() -> void:
queue_free()