Spawner.gd 320 B

1234567891011121314151617
  1. extends Spatial
  2. export var frequency = 0.3
  3. onready var timer = Timer.new()
  4. var boxscene = preload("res://TestBox.tscn")
  5. func _ready():
  6. timer.wait_time = 1.0/float(frequency)
  7. timer.connect("timeout",self,"spawn")
  8. add_child(timer)
  9. timer.start()
  10. spawn()
  11. func spawn():
  12. var box = boxscene.instance()
  13. add_child(box)