Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon Join the GFS Discord Server!

Godot 3 Tutorial–Nodes, Scenes And Trees


This video will starts 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 collction 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

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

extends Node

func _ready():
  print(get_node("Parent").name) #Prints Parent
  print($ # 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

blog comments powered by Disqus

AppGameKit Studio

See More Tutorials on!

Month List