This Readme shows how to use C++ to complete Version 4.6 of Godot’s Your First 2D Game (YF2DG) tutorial. It’s based heavily on an earlier project for Godot 4.3 by J-Dax.
My repository seeks to complement J-Dax’s excellent work by:
-
Laying out the C++ code step by step, similar to how the official tutorial presents GDScript and C# code bit by bit. (This repository also contains completed copies of each C++ file–but it can be tricky, and a bit intimidating, to use those finalized versions as learning aids.)
-
Incorporating a few updates to J-Dax’s code that make it compatible with Godot 4.6.
-
Adding some additional comments on the code and documentation that you might find helpful in your learning journey (especially if you’re a relative beginner to Godot or GDExtension).
A few other notes:
-
This project is not a replacement for the official Godot YF2DG tutorial. You’ll still need to complete most of the steps found in that tutorial in order to get your game working. The purpose of this project is to (1) provide equivalent C++ code for the GDScript and C# code contained in the tutorial and (2) point out sections where your C+±based workflow will differ from the standard workflow. (Examples include creating new classes and adding signals.)
-
I’m working within Linux Mint, but this guide ought to be helpful for other operating systems also.
-
My personal reason for working on this project is that I want to learn how to code games entirely in C++ within Godot. This is not the recommended approach, as GDScript will often allow for faster coding and deployment; it’s simply the method that I find the most interesting, though far from the most convenient (or rational!).
-
This project won’t run on its own because it’s missing certain assets (e.g. fonts, artwork, and sounds) that are provided via the official Godot YF2DG tutorial. However, if you follow the steps within that tutorial, you’ll end up with the materials you need on your own computer–which can then be paired with the C++ code found within this README.
-
If you encounter any problems with the code, please notify me by creating a new issue within the repository.