Make a 2D Platformer in Godot 4 - Complete Beginner Tutorial (GDScript, Godot 4.7)
Back To Code
0:00 / 0:00
Make a 2D Platformer in Godot 4 - Complete Beginner Tutorial (GDScript, Godot 4.7)
285 просмотров · 9 дн. назад
Back To Code
324 подписчика
285 просмотров · 9 дн. назад
Build a complete little 2D platformer in Godot 4, from an empty project to an exported Linux game. We make Astro Hop: run and jump around one screen, collect coins, stomp crawlers, keep your three hearts, and restart after game over.
Along the way: project setup, scenes and nodes, a CharacterBody2D player with gravity and jumping, physics layers and collisions, a TileMapLayer level, coins and enemies, custom signals, sprite animations, a score and health HUD, sound effects and music, particles, screen shake, game over and restart, and a Linux export.
Chapters
0:00 Intro
0:21 What we are building
0:57 Project setup, settings, input map and physics layers
2:14 Assets, scenes and nodes, the player scene
3:27 Player movement script with CharacterBody2D
4:24 Tilemap level and collisions
5:46 Coins, Area2D and signals
7:29 Enemies, stomping and health
9:30 Score, hearts and game over UI
10:44 Sound, particles and screen shake
12:25 Exporting for Linux
12:49 Playing the finished game
13:26 References and thanks
Code: [add link here]
How this video was made (honest notes)
Everything was recorded live in the real Godot 4.7.2 editor (Compatibility renderer, software rendering), with no mockups. The editor input (mouse clicks and typing) was scripted and played back in real time, not typed by hand on camera.
Long editing stretches are sped up, from 1x up to about 14x (the fastest is the Main scene sound setup). A few short clips are slowed to between 0.6x and 0.95x so the narration can keep up. Gameplay clips without game audio run at 1.0x to 1.3x. Gameplay clips with game audio run at real speed.
The gameplay was played by a small input script that reads the screen and presses the arrow keys. It was not played by hand.
Prepared ahead of time, and said so in the video: the SpriteFrames animations for the player, coin and enemy, the TileSet, and the asset folder. The sound effects and music loop were synthesized for this project before recording.
To capture the game sound cleanly, the project has a small recording-only autoload (audio_tap.gd). It only does anything when a recording environment variable is set, and it is not part of the tutorial. You can delete it.
Some parts were retaken: the level painting, the first coin test run (the coin timer had not been saved yet), and the terminal shot of the exported game.
While code is being typed, the editor briefly shows parse errors. These are normal and go away once the line is finished.
Narration is text to speech (Microsoft Edge voice, en-US Andrew).
References
Godot Engine 4.7.2 (MIT license): https://godotengine.org and https://github.com/godotengine/godot/...
Godot license: https://godotengine.org/license
Your first 2D game: https://docs.godotengine.org/en/stabl...
CharacterBody2D: https://docs.godotengine.org/en/stabl...
TileMapLayer and tile maps: https://docs.godotengine.org/en/stabl...
Using signals: https://docs.godotengine.org/en/stabl...
CanvasLayer: https://docs.godotengine.org/en/stabl...
CPUParticles2D: https://docs.godotengine.org/en/stabl...
Exporting projects: https://docs.godotengine.org/en/stabl...
Credits
Art: Pixel Platformer by Kenney (https://kenney.nl/assets/pixel-platfo..., CC0 public domain.
Sound effects and music: original, synthesized for this video.
Godot Engine is MIT licensed, copyright Juan Linietsky, Ariel Manzur and contributors.
#godot #gamedev #godot4 #gdscript #indiedev