If my project and scenes only use control nodes and my main script for each scene also extends control, should any global scripts I create and reference from scene scripts also extend control?
Godot’s default when creating a new script not attached to an object is to extend node.
Probably a simple thing I’ve just overlooked in the documentation, but I can’t find a definitive answer. I can’t really see any difference in function, so it’s really just a matter of semantics, probably.
It’s not a placeholder. It’s the actual type of your autoload Node.
The autoload is a Scene instantiated in the SceneTree, so it can be any Node-derived type, like Control, AudioStreamPlayer, etc. In most cases, making it just a Node type is enough though, so if you don’t need any specific behavior, you don’t need to change it to anything else.
I’ll leave them as Node as that is the default and I see no difference either way. In the example in the documentation it says to make sure it extends Node, though I’m not sure if that is for just that demo project or as a rule.
All nodes in Godot extend node, including Control nodes, Node2Ds, CharacterBody2D, all of these extend node.
I recommend reading up on Object Oriented Programming to understand how inheritance works. That will help you understand why this is the case, and how you can make use of this in your games.
I understand OOP, been programming for many years, was just curious when creating an autoload and whether keeping it at the same level / scope in the OOP tree was preferred in Godot.
I appreciate your advice I’ll read up some more on Godot’s implementation of OOP.
From top to bottom, you have Area2D in this example, which inherits CollisionObject2D, which in turn inherits Node2D, which in turn inherits CanvasItem, which in turn inherits Node.
PS: No need to sign your posts. We can see your profile name.