This commit is contained in:
2022-12-10 23:30:49 +01:00
parent 5942d5bf5a
commit 7c96139422
2 changed files with 26 additions and 6 deletions

View File

@@ -1,11 +1,28 @@
extends Node3D
@onready var rails
# Called when the node enters the scene tree for the first time.
@onready var rails = preload("res://Assets/Model/Objects/rail_tracks.glb")
# Called when the node enters the scene tree for the first time
var offset = 0
func _ready():
pass # Replace with function body.
var timer = Timer.new()
self.add_child(timer)
timer.timeout.connect(create_rail)
timer.set_wait_time(0.2)
timer.start()
func create_rail():
var obj = rails.instantiate()
obj.rotation.y = deg_to_rad(90)
obj.position = Vector3(0,0,13)
offset -= 13
add_child(obj)
var timer = Timer.new()
obj.add_child(timer)
# Connect the timer to make it call "queue_free" after two seconds
timer.timeout.connect(obj.queue_free)
timer.set_wait_time(2)
timer.start()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
position.z += delta * 40