diff --git a/spawner/spawner.gd b/spawner/spawner.gd new file mode 100644 index 0000000..d6981c7 --- /dev/null +++ b/spawner/spawner.gd @@ -0,0 +1,10 @@ +extends Node2D +class_name Spawner +@export var scene: PackedScene +@export var target_parent: NodePath + +func spawn(): + var scene_instant= scene.instantiate() + scene_instant.position=Vector2.ZERO + add_child(scene_instant) + print(scene_instant.global_position) diff --git a/spawner/spawner.tscn b/spawner/spawner.tscn new file mode 100644 index 0000000..91a3670 --- /dev/null +++ b/spawner/spawner.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://c67lfbk4gf1ga"] + +[ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"] + +[node name="Spawner" type="Node2D"] +script = ExtResource("1_xqfmg") + +[node name="Timer" type="Timer" parent="."] +wait_time = 2.908 +autostart = true + +[connection signal="timeout" from="Timer" to="." method="spawn"]