Setting positions of new instances of scenes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tentamens

Hello there!

so I’m making a runner style game and I’m at the point where I need to make new “blocks” or platforms to spawn in front of the player. I was looking up how to set the position of new instances. I found a way to do it but Id need to be needing to move around a bunch of nodes2d which would also impact their children which won’t work unless I make a very very ugly and inefficient file, so If theirs anyway to set the position of the new instances I would love to hear them!

Thanks ahead of time, been banging my head on the table with this one.

:bust_in_silhouette: Reply From: kidscancode

You can just set the position when you instance it:

var new_instance = my_scene.instance()
new_instance.position = Vector2(x, y)
1 Like