Game Development
A new project
Learn to start a new project in Godot and its directory layout.
Creating a new project
In the Godot Project Manager you press New Project, give the project a name and choose an empty directory (folder). Godot puts a project.godot file at the root of that directory; every project setting is stored in this file. You can later change the project name via Project > Project Settings.
func _ready():
print(ProjectSettings.get_setting("application/config/name"))
The ProjectSettings object lets you read the project settings straight from your code.
The project directory and res://
The whole project lives inside the directory you chose, and Godot writes this root path as res://. A common habit is to keep scene files in a scenes/ folder and scripts in a scripts/ folder. When you save a scene its file name ends with the .tscn extension, which is the extension of a Godot scene file.
func _ready():
var yol = "res://scenes/ana_sahne.tscn"
print(yol)
This code prints the res://scenes/ana_sahne.tscn path.
Exercise Project info
Inside _ready, define the variable proje_adi with the value "Uzay Macerası" and the variable kok_dizin with "res://". Then print these two values on two separate lines with the labels Proje: and Dizin: .
Show example solution
func _ready():
var proje_adi = "Uzay Macerası"
var kok_dizin = "res://"
print("Proje: " + proje_adi)
print("Dizin: " + kok_dizin)
Test yourself
-
When you create a new Godot project, which file appears in the project root automatically?
- The file of the first scene: ana_sahne.tscn
- A general settings file: config.ini
- The project settings file: project.godot
- The runnable game file: game.exe
Show answer
The project settings file: project.godot — A new project opens with the project.godot file at its root. Scene files do not appear until you create them.
-
The project root prefix
var sahne_yolu = "____scenes/ana_sahne.tscn"
Show answer
var sahne_yolu = "res://scenes/ana_sahne.tscn"
-
Project pieces
- project.godot
- File storing project settings
- res://
- Project root directory
- scenes/ klasörü
- Folder holding scene files
- Project Settings
- Window to change project name
Next lesson: The scene tree