Obstacles are getting spawned in front of the ground scene?

Godot Version

v4.2.2.stable.official [15073afe3]

Question

Hello! So I was creating a basic flappy bird type of game. While Spawing the obstacles they are getting spawned in front of the ground.

image

This is the code that i wrote.

The first initial pipe is chill, since i placed the Obstacle scene behind the Ground scene. I am unable to understand how to get the pipes to spawn properly. I am just starting out with Godot. Please help me understand how I can achieve this?

Make a node2d in the world, name it obstacles, it will be before the ground, so that pipe will inside the ground so finally change the add_child code to $Obstacles.add_child

Thank you sooo much!! It worked!! I didnt even thought of doing that, thank you!!

1 Like