01.project_setup.rst 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .. _doc_your_first_2d_game_project_setup:
  2. Setting up the project
  3. ======================
  4. In this short first part, we'll set up and organize the project.
  5. Launch Godot and create a new project.
  6. .. image:: img/new-project-button.webp
  7. When creating the new project, you only need to choose a valid *Project Path*. You can leave the other default settings alone.
  8. .. tabs::
  9. .. tab:: GDScript
  10. Download `dodge_the_creeps_2d_assets.zip <https://github.com/godotengine/godot-docs-project-starters/releases/download/latest-4.x/dodge_the_creeps_2d_assets.zip>`_.
  11. The archive contains the images and sounds you'll be using
  12. to make the game. Extract the archive and move the ``art/``
  13. and ``fonts/`` directories to your project's directory.
  14. .. tab:: C#
  15. Download `dodge_the_creeps_2d_assets.zip <https://github.com/godotengine/godot-docs-project-starters/releases/download/latest-4.x/dodge_the_creeps_2d_assets.zip>`_.
  16. The archive contains the images and sounds you'll be using
  17. to make the game. Extract the archive and move the ``art/``
  18. and ``fonts/`` directories to your project's directory.
  19. Ensure that you have the required dependencies to use C# in Godot.
  20. You need the latest stable .NET SDK, and an editor such as VS Code.
  21. See :ref:`doc_c_sharp_setup`.
  22. .. tab:: C++
  23. The C++ part of this tutorial wasn't rewritten for the new GDExtension system yet.
  24. Your project folder should look like this.
  25. .. image:: img/folder-content.webp
  26. This game is designed for portrait mode, so we need to adjust the size of the
  27. game window. Click on *Project -> Project Settings* to open the project settings
  28. window, in the left column open the *Display -> Window* tab. There, set
  29. "Viewport Width" to ``480`` and "Viewport Height" to ``720``.
  30. .. image:: img/setting-project-width-and-height.webp
  31. Also, under the **Stretch** options, set **Mode** to ``canvas_items`` and **Aspect** to ``keep``.
  32. This ensures that the game scales consistently on different sized screens.
  33. .. image:: img/setting-stretch-mode.webp
  34. Organizing the project
  35. ~~~~~~~~~~~~~~~~~~~~~~
  36. In this project, we will make 3 independent scenes: ``Player``, ``Mob``, and
  37. ``HUD``, which we will combine into the game's ``Main`` scene.
  38. In a larger project, it might be useful to create folders to hold the various
  39. scenes and their scripts, but for this relatively small game, you can save your
  40. scenes and scripts in the project's root folder, identified by ``res://``. You
  41. can see your project folders in the FileSystem dock in the lower left corner:
  42. .. image:: img/filesystem_dock.webp
  43. With the project in place, we're ready to design the player scene in the next lesson.