When the game start, it load all the resource so i don't think the resource is the problem. But when the train is in the dynamic rail i do this:
Globals.get(global.actives_rails).append(self)
print ("active rails: ", Globals.get(global.actives_rails).size())
set_process(true)
set_train (train)
and in process i do this:
func _process(delta):
if not has_train ():
return
pass
origin_pos = train.get_pos ()
destiny_pos = destiny.get_pos ()
var train_pos = train.get_pos ()
var new_y = train_pos.y - (delta * train.get_speed ())
train.set_pos(Vector2(train.get_pos().x, new_y))
I was thinking to use my own delta to keep the things stable, because the game is for one player.