01.project_setup.rst 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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``. You can see the
  30. "Project" menu on the upper left corner.
  31. .. image:: img/setting-project-width-and-height.webp
  32. Also, under the **Stretch** options, set **Mode** to ``canvas_items`` and **Aspect** to ``keep``.
  33. This ensures that the game scales consistently on different sized screens.
  34. .. image:: img/setting-stretch-mode.webp
  35. Organizing the project
  36. ----------------------
  37. In this project, we will make 3 independent scenes: ``Player``, ``Mob``, and
  38. ``HUD``, which we will combine into the game's ``Main`` scene.
  39. In a larger project, it might be useful to create folders to hold the various
  40. scenes and their scripts, but for this relatively small game, you can save your
  41. scenes and scripts in the project's root folder, identified by ``res://``. You
  42. can see your project folders in the FileSystem dock in the lower left corner:
  43. .. image:: img/filesystem_dock.webp
  44. With the project in place, we're ready to design the player scene in the next lesson.