Part 3 – Main scene
The Main
scene is what ties all the pieces of the game together. It will manage the player, the coins, the timer, and the other pieces of the game.
Node setup
Create a new scene and add a node named Main
. To add the player to the scene, click the Instance button and select your saved Player.tscn
:

Now, add the following nodes as children of Main
, naming them as follows:
TextureRect
(namedBackground
)—for the background imageNode
(namedCoinContainer
)—to hold all the coinsPosition2D
(namedPlayerStart
)—to mark the starting position of thePlayer
Timer
(namedGameTimer
)—to track the time limit
Make sure Background
is the first child node. Nodes are drawn in the order shown, so the background will be behind the player in this case. Add an image to the Background
node by dragging the grass.png
image from the assets
folder into the Texture
property. Change the Stretch Mode
to Tile
and then click Layout
| Full Rect
to size the frame to the size of the screen, as shown in the following...