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.

设置项目

在这个简短的第一部分中,我们将设置和组织项目。

启动 Godot 然后新建一个项目。

../../_images/new-project-button.webp

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.

您的项目文件夹应如下所示。

../../_images/folder-content.png

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.

../../_images/setting-project-width-and-height.webp

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.

../../_images/setting-stretch-mode.webp

组织项目

在这个项目中,我们将制作3个独立的场景。 Player, Mob, 以及 HUD, 我们将把这些场景合并成游戏的 Main 场景。

在更大的项目中,为各个场景及对应的脚本创建各自的文件夹会比较好。而这是一个相对小型的游戏,你可以把场景和脚本放在项目的根文件夹里,根文件夹用 res:// 表示。可以在左下角的“文件系统”面板中查看项目文件夹:

../../_images/filesystem_dock.webp

项目准备就绪后,我们已准备好在下一课中设计玩家场景。