Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
Setting up the project¶
In this short first part, we'll set up and organize the project.
Spusťte Godot a vytvořte nový projekt.
When creating the new project, you only need to choose a valid Project Path. You can leave the other default settings alone.
Download dodge_the_creeps_2d_assets.zip.
The archive contains the images and sounds you'll be using
to make the game. Extract the archive and move the art/
and fonts/
directories to your project's directory.
Download dodge_the_creeps_2d_assets.zip.
The archive contains the images and sounds you'll be using
to make the game. Extract the archive and move the art/
and fonts/
directories to your project's directory.
Ensure that you have the required dependencies to use C# in Godot. You need the latest stable .NET SDK, and an editor such as VS Code. See Prerequisites.
The C++ part of this tutorial wasn't rewritten for the new GDExtension system yet.
Vaše složka projektu by měla vypadat takto.
This game is designed for portrait mode, so we need to adjust the size of the
game window. Click on Project -> Project Settings to open the project settings
window, in the left column open the Display -> Window tab. There, set
"Viewport Width" to 480
and "Viewport Height" to 720
.
Also, under the Stretch options, set Mode to canvas_items
and Aspect to keep
.
This ensures that the game scales consistently on different sized screens.
Uspořádání projektu¶
V tomto projektu vytvoříme 3 nezávislé scény: Player
, Mob
a HUD
, které zkombinujeme do hlavní scény hry:Main
.
Ve větším projektu může být užitečné vytvořit složky, pro každkou scénu a její skript zvlášť, ale pro tuto relativně malou hru můžete ukládat své scény a skripty do kořenového adresáře projektu identifikovaného pomocí res: //
. Složky projektu můžete vidět v doku Souborový systém v levém dolním rohu:
With the project in place, we're ready to design the player scene in the next lesson.