Godot Engine Game Development Projects
上QQ阅读APP看书,第一时间看更新

Project setup

Launch Godot and create a new project, making sure to use the Create Folder button to ensure that this project's files will be kept separate from other projects. You can download a Zip file of the art and sounds (collectively known as assets) for the game here, https://github.com/PacktPublishing/Godot-Game-Engine-Projects/releases.

Unzip this file in your new project folder.

In this project, you will make three independent scenes: PlayerCoin, and HUD, which will all be combined into the game's Main scene. In a larger project, it might be useful to make separate folders to hold each scene's assets and scripts, but for this relatively small game, you can save your scenes and scripts in the root folder, which is referred to as res:// (res is short for resource). All resources in your project will be located relative to the res:// folder. You can see your project folders in the FileSystem dock in the upper-left corner:

For example, the images for the coin would be located in res://assets/coin/.

This game will use portrait mode, so you need to adjust the size of the game window. Click on the Project menu and select Project Settings, as shown in the following screenshot:

Look for the Display/Window section and set Width to 480 and Height to 720. Also in this section, set the Stretch/Mode to 2D and the Aspect to keep. This will ensure that if the user resizes the game window, everything will scale appropriately and not become stretched or deformed. If you like, you can also uncheck the box for Resizable, to prevent the window from being resized entirely.