Nodes are the building blocks of making a game! You can think of them as ingredients for your game. They can serve a variety of different purposes but they always have the following attributes:
The last point means that every node can have children that are other nodes. This forms what we call a tree. This may be a little confusing right now but it will click when we start creating games! For now, just think of nodes as a way of organizing your game!
A scene is a group of nodes that are organized in a tree. These scenes always have the following qualities:
Running a game in Godot means running the main scene. We can change between scenes as the game runs!
Now let’s work on adding our first node! In the editor, you will notice a plus button in the top left of the scene dock. This button will allow us to add a node into our workspace. This button will always create the node as a child of the selected node unless there are no nodes, in which case, it will create the root node. For this exercise, we will click that button and then add a label node. It should look something like this:
After clicking create, you should see your label node appear on screen! The next step will be to change the label node’s text property to say “Hello, World!” in the inspector.
Now you can click the Play Scene button which looks like this:
You will be prompted to save the scene before you run it. Go ahead and do that now! After you save it, the scene will play and you should see a window pop up that says “Hello, World!”
As of right now, the only way to display your scene is to click the Play Scene button. This is because it has not been set as the main scene. Let’s do that now! To do this simply click Project in the main menu then select Project Settings. Once you have done that, we will set the main scene by doing the following:
This will now allow us to click the regular run button to start our game!