0 votes
extends Spatial

onready var Fly = preload("res://Scenes/Enemies/fly.tscn")

func _ready():
    $Timer.start()

func _on_Timer_timeout():
    var fly = Fly.instance()
    add_child(fly)

I absolutely cannot figure out why this won't work. There is no reason I can see for it not to work.

EDIT:
Alright I've redone the spawner entirely and now it spawns the fly, but now the fly's script doesn't run. Now there is just an annoying completely frozen fly.

in Engine by (144 points)
edited by

Do you get any error messages or does just nothing happen?

Did you connect the Timer's timeout signal? Note: you can set the timer to "Autostart" and you wouldn't have to start it in _ready()

Nothing happened, no crash, no error message. The game ran as expected minus enemies spawning.

EDIT:
Alright I've redone the spawner entirely and now it spawns the fly, but now the fly's script doesn't run. Now there is just an annoying completely frozen fly.

1 Answer

+1 vote

Tried to answer your question here. Writing this to remove the question from unanswered.

by (864 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.