Godot Version
4.2.2.stable
Question
The code only spawns the enemy once how do I make it spawn every time the timer runs out. Also it prints “It works” every 1 second so it is not the timer.
extends Node2D
@export var Enemy = preload(“res://Scenes/Enemy1.tscn”)
var speed = 100
var direction = -1
var I = true
@onready var timer = $“…/Timer”
func _on_timer_timeout():
var spawn2 = Enemy.instantiate()
add_child(spawn2)
spawn2.transform = get_node(“/root/EnemySpawn/Marker2D3”).global_transform
print(“It works”)
func _process(delta):
position.x += speed * direction * delta