Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Position2D
- export (PackedScene) var spawnScene
- onready var spawnReference = load(spawnScene.get_path())
- export (NodePath) var timerpath
- onready var timerNode = get_node(timerpath)
- export(float) var minTimeWait
- export(float) var maxTimerWait
- func _ready():
- randomize()
- timerNode.set_wait_time(rand_range(minTimeWait, maxTimerWait))
- timerNode.start()
- func _on_Timer_timeout():
- var spawnInstance = spawnReference.instance()
- get_parent().add_child(spawnInstance)
- spawnInstance.set_global_position(get_global_position())
- timerNode.set_wait_time(rand_range(minTimeWait, maxTimerWait))
- timerNode.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement