Godot
Setting up Godot
- Download the Godot 4 Standard version from here: https://godotengine.org/download/windows
- Unpack it and run the exe file
- Create a new project by pressing New Project; for a 2D game, Compability is suitable (it will run on more platforms).
Godot Introduction
This is a class diagram of Godot's base classes:
Practice 1
GE Godot 1 - Introduction https://youtu.be/efUrLSe9sMg
GE Godot 2 - Starting Platformer Game - https://youtu.be/hCDXnGiXr0Y
Download assets: https://www.kenney.nl/assets/pixel-platformer
Steps
1. Make a new Godot project in Compatibility mode.
2. Add a "Main" 2D scene and set it to run by default.
3. Create "StaticBody2D" block with a "Sprite2D" and "CollisionShape2D" child nodes.
4. Make the block a scene and create a simple level layout.
5. Create a new "CharacterBody2D" for the player and configure collision and sprite.
6. Add a new script to the player using the proposed template. Turn the player into a scene.
7. Test the player to ensure the collision is functional and collides with the scene.
Practice 2
GE Godot 3 - Improving the Platformer Character - https://youtu.be/cpaMuCQeUh4
GE Godot 4 - Tilemap and Background - https://youtu.be/n8Ve71DmysQ
GE Godot 5 - Implementing Portals - https://youtu.be/8ASaIpPprw8
Steps
1. Make the player's sprite flip based on the movement direction.
2. Replace the player's sprite with an animated sprite. Add idle and run animations.
3. Make the player's movement speed and jump velocity configurable.
4. Create a tilemap for the ground and configure its tileset.
5. Add collision to the tiles.
6. Create terrain and configure tiles for auto tiling.
7. Draw a landscape.
8. Add Camera2D under Player and make it smoothly follow the player.
9. Create a background using ParallaxBackground and ParallaxLayers, and add a new TileMap under it.
10. Create a horizontally repeating background using the provided background tileset.
11. Create a portal node using Area2D that has Sprite2D and CollisionShape2D as children.
12. Add a script to the portal and turn it into a scene.
13. Connect the area_entered signal to the portal.
14. Make the portal only register the collision with the player (Use Duck typing).
15. On player entry, change the scene to another defined in the portal's export variable.
16. Create another scene with a different layout; add a portal to each scene, teleporting to the next.
Practice 3
GE Godot 6 - Spawning Projectiles - https://youtu.be/2_SzKhgjqII
GE Godot 7 - Pause Menu and Dev Tips - https://youtu.be/g8QWohshxP4
Steps
1. Create a projectile node with sprite and collision.
2. Make the projectile move continuously in one direction.
3. Make the player spawn projectiles using the _unhandled_input(event) function.
4. Change the projectile direction based on the player's facing direction.
5. Add VisibleOnScreenNotifier2D to the projectile and destroy it when it leaves the screen.
6. Create a Globals script and turn it into an autoload.
7. Add a Pause UI with buttons for continuing and exiting the game.
8. Implement the buttons.
9. Use the Globals script to toggle the Pause UI on the ESC key.
10. Pause the game when the Pause UI is opened.
11. Extract the shooting behaviour from the Player and turn it into a new subnode, "ShootingBehavior".
Download the finished lab solution:
https://drive.google.com/file/d/1tu5e5gp3MkJBtFpFz8MSNDThNSUyB3Ie/view?usp=share_link
How to export the finished project
Once you have finished your project, you can open the export window "Project->Export". Then you need to add a Windows export preset from the Add menu:
You don't have any export templates by default, however you can download them by clicking on the Manage Export Templates button.
In the export template manager window you can just press Download and Install to download the required templates.
Once the templates are downloaded you are ready to export the project. You can open the export window again and Export Project... button is now available.
Export your project into a new Build folder, and uncheck the Export With Debug checkbox to make the exported build faster. Make sure to test your game before submitting. If your game contains any errors, it will simply crash in the non-debug build.
The exporting creates two files: ".exe" and ".pck", both files are needed to run the game. When you submit your game, include both of them.
Submission
You don't have to submit the game that was done in the labs; however, you should make your own Godot game project. If you wish to continue making a 2D platformer game, you can extend this project, but it has to contain new significant features (e.g. enemies/obstacles/new interactions) to qualify for max points.
Submit the export version of your game. Zip your build folder into a single package and ensure that all the additional files (created when building the game) are also included in this package. Don't submit your source code.
Submission is in CGLearn (link on the main page)