Meet GDScript

I found this to be a nice general introduction to GDScript:

Almost 54 minutes.
The Scene Dock where the scene tree with nodes are shown and manipulated.

The Scene dock is where the game is assembled. Only the scene structure matters to Godot.

It is recommended to structure your scenes and nodes based on what you’ll see in the game and not according to more general design patterns (MVC, etc).

Organise the files and folders in the FileSystem dock however you want (below the Scene dock).

Every GDScript file in your project is a class. The content of the file is the body or local scope of the instance. Instantiation of a class in code requires that you explicitly name the class. To attach a script to a node the script has to extend Node or a Node subclass.

Only base types are passed as values, everything else is passed as a reference. So wrap those bad boys in a dictionary.

class_name Singleton # Required if instantiating in code
extends Node # Required if attached to a node in a scene

# Only called by Node subclasses
func _ready() -> void:
    self.set_process(false) # stops processing each frame
    print(self) # prints the type of the associated node

# Called every frame (if processing is enabled).
# 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
    print("Time lapsed since last call: ", delta)

Navigating Nodes

Everything in a scene is a node. Nodes in a branch have to be uniquely named. They get instantiated when the scene they are a part of gets presented. The nodes are renamed automatically when you add the same node to the same branch more than once.

A reference to a node instance and the attached script is obtained by searching the scene tree (expensive) or using the unique node name:

# Expensive node search
get_tree().get_root().find_node("node_name")

# Cheap lookup all the way from root
get_node("/root/path_to_the_node")

# Relative node path
get_node("../node_name")

Nodes can be assigned to one or more groups (tagged). Groups can be called and notified as a single entity.

Manage groups in the Editor or in code:

add_to_group("guards")
get_tree().call_group("guards", "enter_alert_mode")

Singletons

Scenes and scripts can function as singletons by adding them to the AutoLoad tab in Project Settings. The instance will be attached to the root node where it can be accessed using its given name:

get_node("/root/MySingleton").current()
$/root/MySingleton.sayHi()

More to come..