|Topic was automatically imported from the old Question2Answer platform.
Hi there! I’m looking to make a moving platform that follows checkpoints, and I think it would be super easy to have that set up in an array, and since in the editor I can determine the size, would it be possible to auto fill that with the checkpoint node/scene and create a new instance each time?
ok so this code works how I want it to, it adds the checkpoint I want as it iterates, but the only problem now is that they only show up in code and the console. I want to be able to modify them while in a level so I can quickly design levels
var i = 0
var size = checkpoints.size()
while i < size:
var check = preload("res://Assets/Generic Platforms/checkpoint.tscn")
var inst = check.instance()
checkpoints[i] = inst
i += 1
Illyas_Onii | 2021-05-23 00:25
You will need to do
in order to actually see your checkpoint scene in-game.
Also, it might be more readable to use a for-loop in this case, like this:
for i in (checkpoints.size()-1): #rest of the code here
instead of a while loop.
Coxcopi | 2021-05-24 20:53
thanks for the advice on the for loop, I tried that at first but something errored out. Either way what i’m wanting is for it to show up in the editor, not in game. I just want to be able to quickly set the array size to 3, have 3 objects show up in the editor, and me be able to position them in a level.
I think instead of that I think i can just drag the same scene into the object, and have them auto assign, which is slower sure but its beter than nothing
Illyas_Onii | 2021-05-24 23:32