So, i currently writing a procedurally procedural platform spawner script, and here's the spawn functions :
var platform1Scene = preload("res://Scenes/Platform1.tscn")
func spawnLevelPart():
spawnPosition = lastEndPosition #get the value of lastEndPosition
lastLevelPart = spawnLevelPartInstance() #get the return of the function
lastEndPosition = lastLevelPart.get_node("EndPlatform").position #get the position of the EndPlatform object from the current spanwed platform
func spawnLevelPartInstance():
levelPartInstance = platform1Scene.instantiate() #get the instantation of the scene Platform1
levelPartInstance.transform.origin = spawnPosition #place the instance of the scene Platform1 to the spawnPosition value, so at the EndPlatform object of the previous platform
add_child(levelPartInstance) #add the instance as a child of the node
levelPartInstanceNode = levelPartInstance as Node #make the instance as a node ('cause before that, it was a Transform)
return levelPartInstanceNode #return the node of the instance
The problem i encounter is that the second platform, and all those that follow don't seem to get the spawn position value, as they spawn at the end of their own EndPlatorm object, and not the one of the previous platform.
Did someone can help me resolve that issue ?