summaryrefslogtreecommitdiff
path: root/scenes/main.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scenes/main.gd')
-rw-r--r--scenes/main.gd36
1 files changed, 36 insertions, 0 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")