01.project_setup.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.png
  7. .. tabs::
  8. .. tab:: GDScript
  9. Download :download:`dodge_assets.zip <files/dodge_assets.zip>`.
  10. The archive contains the images and sounds you'll be using
  11. to make the game. Extract the archive and move the ``art/``
  12. and ``fonts/`` directories to your project's directory.
  13. .. tab:: C#
  14. Download :download:`dodge_assets.zip <files/dodge_assets.zip>`.
  15. The archive contains the images and sounds you'll be using
  16. to make the game. Extract the archive and move the ``art/``
  17. and ``fonts/`` directories to your project's directory.
  18. Ensure that you have the required dependencies to use C# in Godot.
  19. You need the .NET Core 3.1 SDK, and an editor such as VS Code.
  20. See :ref:`doc_c_sharp_setup`.
  21. .. tab:: GDNative C++
  22. Download :download:`dodge_assets_with_gdnative.zip
  23. <files/dodge_assets_with_gdnative.zip>`.
  24. The archive contains the images and sounds you'll be using
  25. to make the game. It also contains a starter GDNative project
  26. including a ``SConstruct`` file, a ``dodge_the_creeps.gdnlib``
  27. file, a ``player.gdns`` file, and an ``entry.cpp`` file.
  28. Ensure that you have the required dependencies to use GDNative C++.
  29. You need a C++ compiler such as GCC or Clang or MSVC that supports C++14.
  30. On Windows you can download Visual Studio 2019 and select the C++ workload.
  31. You also need SCons to use the build system (the SConstruct file).
  32. Then you need to `download the Godot C++ bindings <https://github.com/godotengine/godot-cpp>`_
  33. and place them in your project.
  34. Your project folder should look like this.
  35. .. image:: img/folder-content.png
  36. This game is designed for portrait mode, so we need to adjust the size of the
  37. game window. Click on *Project -> Project Settings* to open the project settings
  38. window and in the left column, open the *Display -> Window* tab. There, set
  39. "Width" to ``480`` and "Height" to ``720``.
  40. .. image:: img/setting-project-width-and-height.png
  41. Also, scroll down to the bottom of the section and, under the "Stretch" options,
  42. set ``Mode`` to "2d" and ``Aspect`` to "keep". This ensures that the game scales
  43. consistently on different sized screens.
  44. .. image:: img/setting-stretch-mode.png
  45. Organizing the project
  46. ~~~~~~~~~~~~~~~~~~~~~~
  47. In this project, we will make 3 independent scenes: ``Player``, ``Mob``, and
  48. ``HUD``, which we will combine into the game's ``Main`` scene.
  49. In a larger project, it might be useful to create folders to hold the various
  50. scenes and their scripts, but for this relatively small game, you can save your
  51. scenes and scripts in the project's root folder, identified by ``res://``. You
  52. can see your project folders in the FileSystem dock in the lower left corner:
  53. .. image:: img/filesystem_dock.png
  54. With the project in place, we're ready to design the player scene in the next lesson.