-
Notifications
You must be signed in to change notification settings - Fork 16
At the end of this chapter, you shall run your first Godot game which shows an icon on the top left corner of the screen. Below is the screenshot for Chapter 2.
First of all, create a blank project. Select OpenGL ES 3.0
.
Create three folders: resource
, scene
and scene/main
. We shall store images and fonts from other authors in resource
. Scene files (*.tscn
) and node scripts (*.gd
) belong to a specific scene folder, for example, scene/main
. Move icon.png
to resource
.
Create a Node2D
node as the root one. Rename it to MainScene
. Save MainScene.tscn
to scene/main
. If you press F5 to play the project, Godot prompts you to select a main scene. Choose the scene file we have just created. Press F5 again, you shall see a blank screen.
Next let's tweak project settings. Open Project -> Project Settings
. We shall change these settings in the General
tab.
-
Rendering -> Environment -> Default Clear Color
:282c34
. -
Display -> Window -> Size -> Width
:800
. -
Display -> Window -> Size -> Resizable
:Off
. -
Display -> Window -> Energy Saving -> Keep Screen On
:Off
. -
Application -> Run -> Low Processor Mode
:On
.
The last one is optional. Quote from this reddit post by Calinou
:
If your game doesn't need to refresh the display often, enable Application > Run > Low Processor Mode in the Project Settings. This will make Godot repaint the application window only when there are changes.
Drag and drop resource/icon.png
to viewport. It will be added as a child node to MainScene
node. Set its position to (100, 100)
.
We shall export our project to a new folder, bin
. However, since we want to exclude binary files from version controlling, we need to add one more line to .gitignore
:
bin/
Speaking of which, if you use Github, you can select the .gitignore
file for Godot projects when initializing a repository. Or you can copy mine.
Your project might look like this at current step.
Open Project -> Export
. Click Add
and choose Windows Desktop
as the preset. You might need to install export templates manually if this is your first time exporting. No need to change settings. Click Export Project
.
In the next menu, beware of Export With Debug
on the lower left corner. It is selected by default. If so, there will be a black window to print output messages when running the executable file. Cancel this option if you want to hide the console window. Click Save
. Thus ends Chapter Two.