Category: game mechanics
-
Shooting (Throwing) in Platformer 2D
We have an existing player character; we want to make him fire at enemies, or throw projectiles. This Godot 4 recipe solves this problem. Straight-line vs Parabolic Some objects such as rocks, daggers or arrows should follow parabolic path (under the influence of gravity). But sometimes we are not looking for realism and so we…
-
Making Platformer Player Movement 2D
You want to create a character & move it with code. For 2D platformers. This recipe aims to solve this problem. Making a character In Godot, create a scene with CharacterBody2D as its root. Add a Sprite2D (or AnimatedSprite2D) nodes as its child. Also add collision shape. Overall setup should look like this: Motion mechanics…
-
Making Merchant (Trading) System in Godot
Earlier in this article, I explained how to build an inventory system. Inventory consisted of a bunch of slots carrying an item each. And it was visualized to player so player can interact with it using GUI inputs. Merchant system extends the inventory. The purpose is to allow 2 items to be exchanged (or traded).…
-
Make a 3D Racing Game from Scratch in Godot
Download full source code from GitHub. This article is a breakdown for understanding, and not all code is written here. This tutorial assumes that you are familiar with GDScript & Godot in general. I took inspiration from Need for Speed 2, an old game. The game will have 2 or 3 levels, with a single…
-
Making Boat Physics in Godot
My objective was to make a ship that is floating on water; walkable on deck; and its motion is based on dynamic water waves. Yet it should be cheap to compute, not taking too much frame-rate. Breakdown Full Code Thank you for reading <3
-
Make Inventory System in Godot
So the game I was working on was a risky project, and the best way to keep the risk was to make every component of the game as much independent as possible from other components, to ensure that a component failure doesn’t affect the entire project. Inventory system I required was similar to Minecraft. I…