Godot References For Godot Developers

June 1, 2021 by Milicen

An ever growing reference of Godot Engine from an enthusiastic indie game developer for other aspiring game developers

  • game-dev
  • godot

This article is solely for providing references to Godot, from manipulating nodes, resource files, to programming.

This article will update frequently as I found more and more interesting stuff while developing games in Godot.

I use C# as the main language, but you can also iterate my C# code into GDScript.

There isn't any specific order in this reference for now. But I might make sections to distinguish between each category.

Well then, here goes the list.

To restart a scene, do :

GetTree().ReloadCurrentScene()

This method works on all nodes EXCEPT autoloaded nodes.

A signal can be connected to many instances

If we dont have any sprites to use, we can make a sprite scene made with polygons 2d.

It's kind of like drawing with a pen tool, except each points doesn't have any handles to control the curves

An async method can have multiple awaits.

Async methods don't allow calling await for value. It only accepts await ToSignal(object, signal_name)

Resources is only for holding data. Doesn't have any functions (_Ready, _Process, etc).

When a resource data has been set, it will apply to all instance using it. Modifying a data from one script will also change the data on other script that uses the same resource.

Flipping nodes by inverting the scale will break functionality. To flip a KinematicBody2D in Godot3 you need to set the global_transformation inside the _physics_process()

scale(1,1) -> set_global_transform(Transform2D(Vector2(1,0),Vector2(0,1),Vector2(position.x,position.y)))  
scale(-1,1) -> set_global_transform(Transform2D(Vector2(-1,0),Vector2(0,1),Vector2(position.x,position.y)))  

1 tween can animate multiple nodes

Multidimensional array c# :

int[,] multiIntArray= new int[5,6]
multiIntArray.Rank // get the number of dimension, in this case 2
multiIntArray.GetLength(0) // get the number of object inside the first dimension
multiIntArray.GetLength(1) // get the number of object inside the second dimension
multiIntArray.Length // get the total number of object stored inside the array
multiIntArray[2,1] // get the first object inside the second array of the multi-dimension array