On making the smiley scene, the sprites are rearranging and positions are changing on running

This is my scene in the editor:

But on running it renders this:

When i debug, the position of every sprite is changed to the same position.

Sprite: Sprite2D Position: (576.0, 324.0)
Sprite: Sprite2D2 Position: (576.0, 324.0)
Sprite: Sprite2D3 Position: (576.0, 324.0)
Sprite: Sprite2D5 Position: (576.0, 324.0)
Sprite: Sprite2D4 Position: (576.0, 324.0)
Sprite: Sprite2D11 Position: (576.0, 324.0)
Sprite: Sprite2D10 Position: (576.0, 324.0)
Sprite: Sprite2D6 Position: (576.0, 324.0)
Sprite: Sprite2D8 Position: (576.0, 324.0)
Sprite: Sprite2D7 Position: (576.0, 324.0)
Sprite: Sprite2D9 Position: (576.0, 324.0)

What do you think is wrong???

what do your scripts look like?

1 Like

Maybe you could use a canvas layer? If you make all those sprites a child of the canvaslayer it will always look like that in any screen size (i think)

1 Like

Got it. That was indeed the problem. I had same script attached to all sprites and it was by default centering.

func _ready():
center_node(self)

func center_node(node):
var screen_size = get_viewport().size
node.position = screen_size / 2

1 Like