level 2 - moving plattforms
level2 almost finished
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends Node2D
|
||||
@onready var timer = $Timer
|
||||
|
||||
@export var obj : PackedScene
|
||||
@export var delay : float
|
||||
|
||||
var instances = []
|
||||
|
||||
func _ready():
|
||||
timer.wait_time = delay
|
||||
timer.start()
|
||||
|
||||
func _on_timer_timeout():
|
||||
var instance = obj.instantiate()
|
||||
instance.position.x = 0
|
||||
instance.position.y = 0
|
||||
add_child(instance)
|
||||
instances.append(instance)
|
||||
|
||||
if len(instances) > 5:
|
||||
var curr = instances.pop_front()
|
||||
curr.queue_free()
|
||||
Reference in New Issue
Block a user