tutorials/best_practices/what_are_godot_classes #75
Replies: 7 comments 5 replies
-
|
Why doesn't Godot use usual classes? What is the requirement to use ClassDB? |
Beta Was this translation helpful? Give feedback.
-
|
What is the difference between scenes, nodes, and classes, and are all scenes and nodes just class instances? |
Beta Was this translation helpful? Give feedback.
-
|
Scenes are likes block we can put them together to build bigger things. Nodes are smaller blocks we put them together to build scenes, the bigger blocks. Once we put them all together, we can have a well organized game =) |
Beta Was this translation helpful? Give feedback.
-
|
Hello! I'm a big fan of Godot, and I'm learning it with enthusiasm! I'm reaching out to make sure I understand things correctly and to get feedback on any misconceptions I might have. Here’s my question: In the end, classes are created for reusability, but in Godot, we can achieve this with nodes and scenes. So, does that mean we don’t really need to create classes, and that we can implement object-oriented design by combining nodes and scenes effectively? |
Beta Was this translation helpful? Give feedback.
-
|
if someone will be searching on how to move a class into separate file, here is a good tutorial: const Motorcycle = preload("res://Motorcycle.gd") # this goes to the top of your file
........
......
var moto = Motorcycle.new() |
Beta Was this translation helpful? Give feedback.
-
|
Best way I can understand this is:
|
Beta Was this translation helpful? Give feedback.
-
|
When you instantiate a child scene, it shows the script of the child scene's root node. You can, however, detach the script from the instance. Is that intentional? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
tutorials/best_practices/what_are_godot_classes
The engine offers two main ways to create reusable objects: scripts and scenes. Neither of these technically define classes under the hood. Still, many best practices using Godot involve applying o...
https://docs.godotengine.org/en/stable/tutorials/best_practices/what_are_godot_classes.html
Beta Was this translation helpful? Give feedback.
All reactions