Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
设置项目¶
在这个简短的第一部分中,我们将设置和组织项目。
启动 Godot 然后新建一个项目。
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 先决条件.
The C++ part of this tutorial wasn't rewritten for the new GDExtension system yet.
您的项目文件夹应如下所示。
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 and 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.
组织项目¶
在这个项目中,我们将制作3个独立的场景。 Player
, Mob
, 以及 HUD
, 我们将把这些场景合并成游戏的 Main
场景。
在更大的项目中,为各个场景及对应的脚本创建各自的文件夹会比较好。而这是一个相对小型的游戏,你可以把场景和脚本放在项目的根文件夹里,根文件夹用 res://
表示。可以在左下角的“文件系统”面板中查看项目文件夹:
项目准备就绪后,我们已准备好在下一课中设计玩家场景。