2048-Shooter/Spawner.gd
2022-11-24 22:34:56 +01:00

25 lines
475 B
GDScript

extends Panel
var enemy_pre = preload("res://Entity.tscn")
var enemy = null
var e_speed = 50
var e_life = 2
var Time = 0
# Called when the node enters the scene tree for the first time.
func _ready():
if randi() % 2 == 0:
enemy = enemy_pre.instance()
add_child(enemy)
pass
func _process(delta):
Time += delta
if Time > 3.5:
if randi() % 2 == 0:
enemy = enemy_pre.instance()
enemy.speed = e_speed
enemy.life = e_life
add_child(enemy)
Time = 0