Randomize window position
This commit is contained in:
parent
cdc892590b
commit
b62bbaac0d
3 changed files with 9 additions and 9 deletions
|
@ -14,9 +14,16 @@ func _process(delta: float) -> void:
|
|||
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_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)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[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/main.gd" id="1_y7a0r"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2awdq32lxnef" path="res://scenes/microgames/microgame_window.tscn" id="3_ehgys"]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
script = ExtResource("1_y7a0r")
|
||||
|
@ -12,8 +11,6 @@ position = Vector2(636.307, 381.672)
|
|||
scale = Vector2(0.293995, 0.217148)
|
||||
texture = ExtResource("1_o2s48")
|
||||
|
||||
[node name="Window" parent="." instance=ExtResource("3_ehgys")]
|
||||
|
||||
[node name="Score" type="Label" parent="."]
|
||||
offset_top = 2.0
|
||||
offset_right = 83.0
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b2awdq32lxnef"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b2awdq32lxnef"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/microgames/microgame_window.gd" id="1_8ce8l"]
|
||||
[ext_resource type="PackedScene" uid="uid://baukkysebggup" path="res://scenes/microgames/window_mvp.tscn" id="2_asfd5"]
|
||||
|
||||
[node name="Window" type="Window"]
|
||||
auto_translate_mode = 1
|
||||
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("1_8ce8l")
|
||||
|
||||
[node name="WindowMvp" parent="." instance=ExtResource("2_asfd5")]
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
|
|
Loading…
Add table
Reference in a new issue