Godot Version
4.7.1 Stable
Question
I am trying to make the beginnings of a procedural generation, but it doesn’t change the position after the first duplication. I am trying to make the boxes spawn edge-to-edge.
while i > 0:
var boxDupe = box_1.duplicate()
add_child(boxDupe)
boxDupe.name = "box_" + str(get_child_count())
boxDupe.scale.x = randf_range(0.3, 1.7)
var prevBox = get_child(get_child_count() - 2)
print(str(boxDupe.scale.x) + " Dupe scale x")
print(str(prevBox.scale.x) + " Previous scale x")
boxDupe.global_position.x += (prevBox.scale.x / 2 + boxDupe.scale.x / 2)
print(str(boxDupe.global_position.x) + "Dupe")
print(str(prevBox.global_position.x) + "Previous")
boxDupe.freeze = true
prevBox = null
boxDupe = null
i -= 1