Godot 3 Tutorial–Nodes, Scenes And Trees

This video will start looking at the internals of Godot game development.  The fundamental building block in Godot is the Node.  A scene or level in Godot is ultimately just a collection of Nodes, while the scene tree is the conductor behind it all.  This tutorial looks at all of this, including source code for how to manipulate nodes, scenes, and more.

The Video

Assets and Code Samples

Child.gd

extends Node


func _ready():
  print(get_parent().name) #Prints Parent
  print(get_node("..").name) #Prints Parent
  print(get_node("../../").name) #Prints GrandParent
  print(get_parent().get_parent().name) #Prints GrandParent
  print(get_tree().get_root().get_node("Root/GrandParent").name) #Prints GrandParent
  print(get_tree().get_root().get_node("Root/GrandParent/Parent").name) #Prints Parent

GrandParent.gd

extends Node


func _ready():
  
  print(get_node("Parent").name) #Prints Parent
  print($Parent.name) # Prints Parent
  print(get_child(0).name) # Prints Parent
  print(get_node("Parent/Child").name) # Prints Child
  print(get_parent().name) # Prints Root
  print(get_tree().get_root().find_node("Child",true,false).name) # Prints Child
  print(get_children()[0].name) # Prints Parent

Back to Tutorial Series Homepage

Scroll to Top