Avast ye, this be a machine-translated text anâ may contain errors, aye!
Where be this information cominâ from?
Much oâ this be just a tellinâ oâ Godotâs official documentation. Below yeâll find some useful links to the official documentation (which I mostly recommend over this one on Piggy, but if ye prefer this one, then just use it!)
Useful treasures to aid yer journey:
- Godot - Step by step
- Godot - Yer very own swashbucklinâ adventure for two dimensions
- Godot - The Captainâs quarters
What about graphics, be I to make âem meself?
Nay! Ye can find plenty oâ free booty here:
Other handy scallywagâs guides anâ charts:
Other game engins?
If ye prefer, ye can use other game engins. Examples oâ other game engins be:
There be many others too, search away if ye wish to try somethinâ else!
What be Godot?
Godot (Pronounced Gah-doeh), be a âGame Engineâ. To put it simply, âtis a tool that lets ye craft games (or regular programs if yer heart desires). Godot can handle most of what other game engines can muster, both for 2D and 3D adventures.
Examples oâ tales crafted in Godot: Godot Showcase
âTis not just indie scallywags whoâve built their ships with Godot; Sonic Colors Ultimate was forged wiâ Godot! đŚđŚđŚ
How dost thou obtain Godot?
Thou mayest either download Godot from:
- The official page: Godot Official Page.
- Or upon Steam: Godot Steam.
Simply fetch it, install theeâs self withal (or run on Steam), matey! Arrr! đ´ââ ď¸ââ¨đđđŚđđđĄď¸đĽđťđ¤â¤ď¸đââ ââđŻâď¸ââşââžď¸ă°ď¸âťâď¸âźď¸Â§â âĄÂśâŹÂŁÂĽÂ˘Â¤ÂŠÂŽâ˘Â°ÂąÂ˛ÂłÂľÂšÂźÂ˝Âžâ â ââââââľââšâ âââÂŹâ§â¨âŠâŞâ â¤âĽâsimprops~â=|áĂ+â==âˇâââŤâŹââŽâŻâ°âąâ˛âłââˇâĄâ âŞâŤâŹââââ
Set up a project!
When ye start Godot, this window appears before yer eyes:
Here they ask which programming tongue thou wilt use: GDScript or C#? Now, GDScript be much like unto Python.
Differences âtwixt GDScript and Python (sans colors):
def hello():
text = "Hello world!"
print(text)
func hello():
var text = "Hello world!"
print(text)
To declare variables in the ways of Python, all one need do is speak its name. But in GDScript, thou must prefix it with var. To forge functions, write func instead oâ that pesky little word def.
Scenes anâ Nods
One oâ thâ most important concepts within tha world of Godot is ye Scenes anâ Nods. Weâll start with the nods first off. A nod be a object inside Godot, anâ it can represent anythinâ. It could summat that represents a player, a villain, a button on a menu, text appearinâ upon yer screenâany manner oâ thing at all. The scenes themselves? Theyâre just a collection oâ those very same nods.
Here we shall craft ourselves a mighty simple example to show howât works.
Part 1a - Set up the âplayerâ scene
At the top oâ the Godot window, press the â2Dâ button tae change yer view tae a 2D vista.
On thâ left side oâ the window yeâll see this here interface:
Press thââOther Nodeââ button anâ search fer âCharacterBody2Dâ, pick it anâ hit âCreateâ. This be a node used fâr a 2D scallywag. Ye might notice thereâs a warning triangle â ď¸ next tae thââCharacterBody2Dââ node. That be because sheâs missinâ some things sheâd like tae have.
If ye right-click onnae node, yeeâll find â+ Add Child NodeâŚâ Use that one to add two nodes: Sprite2D and CollisionShape2D. The Sprite2D be fur displayinâ graphics upon our hero, while thaâther one checks for collisions. Yee can name them if it helps keep track of thy affairs. I named my CharacterBody2D âPlayerâ. Here be how thâ scene should look now:
Part 1b - Fixinâ â ď¸ on CollisionShape2D
Thâ warning triangle in this case means that thâ CollisionShape2D lacks actual collision detection. Ye can fix this by clickinâ on the node (tâ left), anâ a panel will appear on târightâ. Here yeâll see a whole bunch oâ info about the node what ye can change up. Go ahead anâ play around with it all. But we want to focus on âShape,â set it to sumfinâ, like RectangleShape2D. It donât matter much anyway, as we ainât usinâ collisions here.
Part 1c â Addinâ a Spritâ, some graphics
If ye tap on Sprite2D to thâ left, yeâll see thâ field appear tâ thâ right where it says âTexture.â Here yarr can shove an image for thâ player. Just drag an image into that box anâ let go!
Hereâs how ât looks after addinâ a spritâ.
Part 2 â Addinâ yer inputs, check it!
At the top oâ the window yeâll see a menu bar: âScene - Project - Debug - Editor - Helpâ. Click on âProjectâ anâ then select âProject Settingsâ. That here will bring up a list full oâ settings. Find and click âInput Mapâ. Here be where ye can set which buttons on yerself keyboard do what in battle.
- In the field labeled âAdd New Actionâ, type âleftâ anâ hit that olâAdd button.
- Do thâ same for ârightâ, âupâ, and âdownâ.
- We call these commands âActionsâ.
- On each of them Actions, press the + sign to the right tâ assign a keypress command.
- Now just tap away at yer keys one by one after hittinâ add fer each new move.
- Make sure ye bind those fancy keys onto all active moves before settin sail!
Part 3 - Add a script tâ control yer player.
Tae add game logicâmeanninâ, doinâ summat with thâ player, background, or whatever ye fancy in the gameâyou need yerself a script. Scripts be code, anâ they can be written in two tongues: GDScript or C#. We use GDScript by default here on this ship.
- Click on thâ âCharacterBody2Dâ node (Iâve named it âPlayerâ).
- Hit that âAttach Scriptâ button (see below).
- A windowâll pop up wherâer ye choose thy tongue (pick GDScript) and set a path (just leave âtis as is, though ye may name it if thou wilts). Then click onward! Ye shall see a âScriptâ windw appear. Not much to behold there at first glance, arrr.
# Extends th' Character Body 2D class
extends CharacterBody2D
The sole tale this code be tellinâ fer now is that it shall belong tâ a Node oâ type âCharacterBody2Dâ, which be our brave hero on thâ high seas!
Weâll soon tack in a function here, wherewith we shanât fail tâ maneuver yer trusty player character like true scallywags do their ships! đ´ââ ď¸â
# Argh! Extend th' character body 2D
class_name MyCharacter extends CharacterBody2D
# Called every physics frame, ye scallywag!
func _physics_process(delta: float) -> void:
# Batten down the hatches an' do nothin' fer now!
pass
Yarrs oâ Science?
_physics_process be a function that gets updated every single frame, arrr, roughly sixty times per second by default. There exists another scallywag called _process, which updates all wobbly way long if ye want yer pirate to move smooth as silk on the high seas then use _physics_process.
It be here we shall put in code that moves thâ player.
Part 4 - Basic input
In part 2 ye added buttons tâ thâ Input map, now weâll put âem to use. There be a built-in object named Input that we can useto check if the player has pressed any oâ them keys we set up in thââInput Map.â
Try stickinâ this bit oâ code inside yerselfâs _physics_process:
# If the right key be pressed down...
if Input.is_action_pressed('right'):
# Set our speed along th' X-axis!
velocity.x = 100
# Slide us alang this here path!
move_and_slide()
What be move_and_slide()?
move_and_slide() be anĺ
罎 function in Godot that we use when we want to actually move what itâs applied upon. Without this, the player will not move their hull.
Warning
The space between de lines be mighty important, just like in Python, arrr.
What be happeninâ when ye start the program by pressinâ the play button in the Godot window, then press ârightâ?
If naught be happeninâ now:
- Did ye remember to set somethinâ up in the âInput Mapâ?
- Did ye write
rightand notRight? That is, be what ye wrote in the code the same as the name in the input map?
The whole code so far
extends CharacterBody2D
func _physics_process(delta: float) -> void:
if Input.is_action_pressed('right'):
velocity.x = 100
move_and_slide()
Aye, now try tâ add code fer 'left', 'up', 'down'.
What must velocity.x be fer left? What âbout up anâ down?
The whole shebang 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 5 - Fixinâ up the Code
Ye mightâve noticed that the player donât come to a halt when ye let go of a direction. We can sort that out right now!
Before all them ifs, add a line tae set the velocity to zero. Ye can do this by writinâ velocity = Vector2().
All speeds anâ directions in Godot are vectors. Thatâs a math concept we wonât dive into just yet, but if yer curious about what it means, ye can head over here: Wikipedia vectors.
The whole scurvy code 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 ye start up thâ game now, ye can move about yer player ship:
Furthermore, ye scallywags might fix up thâ code so that speed ainât just a number, but be stored in another spot.
Ye could add a constant, fer instance (before thâ function), to keep track oâ yonder speed.
The whole code at last 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 - Tinker to yer heartâs content!
If ye return tâ thâ first part, Useful Resources, ye can find what ye may continue tâ play wiâ.
After that, try craftinâ yerself a game oâer own. What ye build is up tâ ye! If ye wish tâ forge summat brand new, then by all means, do it! If ye want tâ mimic an already existinâ game, go fer ât! Thâ finest way tâ learn be through trial and error! Arrr!





