mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
infinite scroll
This commit is contained in:
@@ -37,7 +37,7 @@ func _ready():
|
||||
p2_train.is_P1 = false
|
||||
p1_train.hit.connect(_on_hit_player)
|
||||
p2_train.hit.connect(_on_hit_player)
|
||||
p1_train.current_speed = 6
|
||||
p1_train.current_speed = 20
|
||||
p2_train.current_speed = 6
|
||||
|
||||
func getMapSize(node, is_start):
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var rails = preload("res://Assets/Model/Objects/rail_tracks.glb")
|
||||
@onready var rails = preload("res://Nodes/rail_tracks.tscn")
|
||||
@onready var container = $Container
|
||||
# Called when the node enters the scene tree for the first time
|
||||
var offset = 0
|
||||
var offset = -13
|
||||
var last_obj
|
||||
func _ready():
|
||||
var obj = rails.instantiate() as Node3D
|
||||
#obj.position = position
|
||||
add_child(obj)
|
||||
obj.position = Vector3.ZERO
|
||||
last_obj = obj
|
||||
|
||||
var timer = Timer.new()
|
||||
self.add_child(timer)
|
||||
timer.timeout.connect(create_rail)
|
||||
@@ -12,17 +20,7 @@ func _ready():
|
||||
|
||||
func create_rail():
|
||||
var obj = rails.instantiate()
|
||||
obj.rotation.y = deg_to_rad(90)
|
||||
obj.position = Vector3(0,0,13)
|
||||
offset -= 13
|
||||
#obj.position = position
|
||||
obj.position.z = last_obj.position.z + offset
|
||||
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()
|
||||
|
||||
func _process(delta):
|
||||
position.z += delta * 40
|
||||
last_obj = obj
|
||||
|
||||
Reference in New Issue
Block a user