1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 15:24:18 +00:00

made basic spawner

This commit is contained in:
Matteo Balugani 2023-09-30 20:16:14 +02:00
parent 2e09a7ad2e
commit ff2137367f
2 changed files with 22 additions and 0 deletions

10
spawner/spawner.gd Normal file
View file

@ -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)

12
spawner/spawner.tscn Normal file
View file

@ -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"]