This doth be a machine-wrought text which may contain errors!
Whence doth this information spring?
Much hereof is but a recounting of Godot’s official documentation. Underneath ye shall find some helpful links to the said documentation (which I do most heartily commend above this upon Piggy, yet if thou dost prefer this, use it freely!)
Usefull resources:
What of the artistry, must I fashion it with mine own hands?
Nay, good sirs! Ye may discover a wealth of free treasures here:
Other most useful links:
Other game engines?
If thou dost prefer it, thou mayest employ other game engines. Examples of such engines are:
There exist many others also, seek freely if thou wouldst essay something else!
What be Godot?
Godot (Pronounced Guh-doh), is a ‘Game Engine’. To speaketh it simply, ‘tis a program that alloweth thee to fashion games (or common programs, shouldst thou desire). Godot may performeth much of what other game-engines are able to do, both in 2D and 3D.
Examples of games wrought in Godot: Godot Showcase
‘Tis not merely Indie games that have been fashioned in Godot, Sonic Colors Ultimate was made with Godot! 🦔🦔🦔
How Doth One Obtain Godot?
Thou mayest either download Godot from:
- The Official Site: Godot Official Page.
- Or upon Steam: Godot Steam.
Simply download and install (or run upon Steam).
Set forth a project!
When thou dost commence Godot, this window shall appear unto thee:
Herein thou art questioned touching the tongue of programming, be it GDScript or C#. GDScript doth resemble Python passing greatly.
Differences betwixt GDScript and Python (void of colour):
def hello():
text = "Hello world!"
print(text)
func hello():
var text = "Hello world!"
print(text)
For variables in Python, thou needest but to write the name of the variable. In GDScript, thou must write var first. To fashion functions, thou writest func instead of def.
Scenes & Nodes
One of the most principal concepts within Godot doth be Scenes and Nodes. We may begin with Nodes. A Node is an object within Godot, and ‘tis may represent all things. It may be something which doth represent a player, an enemy, a button in a menu, text upon the screen, all manner of things. Scenes are a gathering of Nodes.
Here shall we create a most simple example.
Part 1a - Set Up the “Player” Scene
Upon the uppermost part of the Godot window, press the “2D” button to alter the view to a 2D prospect.
On the left side of the window, ye shall behold the following interface:
Press the “Other Node” button, and seek for “CharacterBody2D”, choose it, and press “Create”. This is a node used for a 2D player. Perchance ye observe a warning triangle ⚠️ beside the “CharacterBody2D” node. This doth signify it lacketh certain things it doth desire.
If thou right-click upon the node, there is a “+ Add Child Node…” button. Use this and add two nodes, Sprite2D and CollisionShape2D. Sprite2D is used to add some graphics unto the player, whilst the other is used to check for collisions. Thou mayest also give them names, if it maketh it easier to keep track of things. I have given mine CharacterBody2D the name “Player”. Thus should the scene appear now:
Part 1b - To Mend ⚠️ the CollisionShape2D
The triangle of warning in this instance is that the CollisionShape2D lacketh true collision. Thou mayest remedy this by pressing upon the node (unto the left), whereupon a panel shall appear upon the right side. Herein thou shalt find a multitude of information regarding the node which thou mayest alter. Pray, play about with that which is presented. Yet, that which we desire to focus upon is “Shape”; set this, for instance, to RectangleShape2D. It mattereth not greatly, for we shall not employ collisions herein.
Part 1c - To Add a Sprite, a Graphic
If thou dost press upon Sprite2D on the left, there shall appear the field on the right, wherein it is writ “Texture”. Herein thou mayest place an image for the player. Thou needest but drag an image and let it fall into the field.
Thus shall it appear after a sprite hath been added.
Part 2 - Adding Input, Controls
At the pinnacle of the window doth reside a menu, “Scene - Project - Debug - Editor - Help”. Press upon “Project” and thereafter “Project Settings”. Here shall appear a menu with a multitude of settings. Press upon “Input Map”. Here may ye set up buttons upon the keyboard.
- In the “Add New Action” field, write “left” and then press “Add”.
- Thereafter, add “right”, “up” and “down”.
- These shall be known as “Actions”
- Upon each “Action” may ye lay in buttons by pressing the + button to the right.
- Here ‘tis but to press upon the keyboard, then press Add.
- Add buttons upon all actions.
Part 3 - Adding a Script to Govern the Player.
To be able to add game logic, that is, to do something with the player, the background, or what else it may be in the game, we require a script. Scripts are code, and may be writ in two tongues, GDScript or C#, GDScript being the default.
- Press upon the “CharacterBody2D” node (I have named it “Player”).
- Press upon the “Attach Script” button (see below)
- Here shall appear a window wherein ye may choose a language (choose GDScript) and a path (leave it as it stands, but ye may give it a name), and then press forward. Here shall appear a “Script” window. Little doth it contain at the beginning.
extends CharacterBody2D
# Dette er en enkel karakterkontroller.
# 'Tis a simple character controller, forsooth.
# Hastighet for bevegelse.
# Speed at which the character doth move.
var speed = 200
func _physics_process(delta):
# Hent input fra spilleren.
# Gather input from the player, pray thee.
var direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
# Beveg karakteren.
# Move the character, good sir.
velocity.x = direction.x * speed
velocity.y = direction.y * speed
move_and_slide()
Hark! This code doth presently declare but this: that the same shall pertain to a node of the sort “CharacterBody2D,” which, in sooth, is our player.
We shall add a function here, which we shall employ to manipulate the player:
extends CharacterBody2D
func _physics_process(delta: float) -> void:
# Dette er en tom funksjon.
# 'Tis a void function, forsooth.
return
Physics Process?
_physics_process is a function which doth update with each and every “frame”, that is to say, some sixty times per second (by default). There existeth another function, named simply _process, which doth update continually. Shouldst thou desire that thy player move at a steady pace, then use _physics_process.
Hark, ‘tis here we shall add the code which doth convey the player.
Part 4 - Basic input
In part 2, thou didst add input buttons; now shall we employ them. There existeth a built-in object named Input which we may use to discern if the player hath pressed that which we have established within the “Input Map”.
Pray, attempt to insert this code into the _physics_process code:
if Input.is_action_pressed('right'):
# Flytt karakteren mot høyre.
# Hither doth the character move towards the right.
velocity.x = 100
move_and_slide()
Hva er move_and_slide()?
move_and_slide() is a built-in function within Godot, employed when we desire to truly move that which we apply it upon. Without this, the player shall not move.
Warning
The space ‘twixt lines doth hold a mighty sway, even as ‘tis done in Python’s way.
What doth betide when thou dost commence the programme by pressing upon the play button within the Godot window, and then dost press “right”?
If naught doth occur now:
- Hast thou remembered to set up aught within the “Input Map”?
- Hast thou writ
rightand notRight? That is to say, is that which thou didst write in the code the selfsame as the name within the input map?
The whole of the code thus far
extends CharacterBody2D
func _physics_process(delta: float) -> void:
if Input.is_action_pressed('right'):
velocity.x = 100
move_and_slide()
Now endeavor to add code for 'left', 'up', and 'down'.
What must velocity.x be for left? What of up and down?
The whole of the code even now
extends CharacterBody2D
func _physics_process(delta: float) -> void:
if Input.is_action_pressed('right'):
velocity.x = 100
if Input.is_action_pressed('left'):
velocity.x = -100
if Input.is_action_pressed('down'):
velocity.y = 100
if Input.is_action_pressed('up'):
velocity.y = -100
move_and_slide()
Part the Fifth - Rectifying the Code
Perchance ye do observe that the player doth not cease motion when thou release a direction. ‘Tis a matter we may amend anon!
Ere all the if-clauses, add a line which doth set velocity to naught. This may be done by writing velocity = Vector2()
All speeds and directions in Godot are vectors, a mathematical conceit we shall not delve into at this present, yet should ye desire further knowledge of its meaning, ye may repair hither: Wikipedia vectors.
The whole of the code even now
extends CharacterBody2D
func _physics_process(delta: float) -> void:
velocity = Vector2()
if Input.is_action_pressed('right'):
velocity.x = 100
if Input.is_action_pressed('left'):
velocity.x = -100
if Input.is_action_pressed('down'):
velocity.y = 100
if Input.is_action_pressed('up'):
velocity.y = -100
move_and_slide()
When thou dost commence the game anon, thou mayest move the player about:
Furthermore, ye may amend the code such that the speed be not merely a number, but may be stored elsewhere.
Forsooth, thou mayest (ere the function) add a constant to keep track of the speed.
The entire code at the end with const
extends CharacterBody2D
const SPEED = 100
func _physics_process(delta: float) -> void:
velovity = Vector2()
if Input.is_action_pressed('right'):
velocity.x = SPEED
if Input.is_action_pressed('left'):
velocity.x = -SPEED
if Input.is_action_pressed('down'):
velocity.y = SPEED
if Input.is_action_pressed('up'):
velocity.y = -SPEED
move_and_slide()
Part 6 - Sport and Play Thyself!
If ye return to the first part, Helpful Resources, ye may find what ye can continue to sport with.
After this, ye may attempt to create thine own game. What ye fashion is left to thine own devising! Shouldst thou desire to create something wholly new, do so! If ye wouldst attempt to imitate a game which doth already exist, do so! The best way to learn is by trying!




