This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm following Your First Game to make my own project and try the same way to spawn enemy.

The enemy scene comes up on the screen once after the first "timeout" signal but after that the scene doesn't appear anymore.

Here is the stage's scripts:

extends Node2D

var f_as1 = preload("res://elements/formations/f_alpha_straight_toptobot_ch1.tscn")
var aship = preload("res://elements/elements/e_enemy_alpha.tscn")
export (PackedScene) var enemy

func _ready():
    $Timer.start()
    pass

func _on_Timer_timeout():
    enemy = f_as1.instance()
    add_child(enemy)
    $Timer.start()
    pass

Thanks in advance!

in Engine by (65 points)

I'm sure you already checked this, but i have to ask.. you have one shot property of timer unchecked, don't you?

Oh, never mind.. you start the timer again inside.

I pasted your code in my pc and works. Could you share the project? may be mistake is elsewhere

I had a bug once that the signal would not be sent to the same script (to self), I had to create a new script just no handle the timeout. Maybe this is what is happening.

and could you share the project?

Please log in or register to answer this question.

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.