Are these fundamentally different stuff or they are the same type of thing? I am a bit confused. I know how to do classes in Python (which is more similar to second example) but seeing these two makes me confused bit.
(never mind the declaration names variables etc, I am asking about the structure and declaration stuff)
class_name Player
var health: int = 100
var name: String = "Unnamed"
func take_damage(amount: int):
health -= amount
if health <= 0:
print("Player", name, "has died!")
class MyClass:
func my_method():
print("Hello, GDScript!")
Scripts in Godot always define classes, implicitly. The class keyword is for inner classes, which is basically a bunch of syntax for addressing and scope behaviour. You should usually create classes with scripts unless you have a reason to use an inner class. Other than that they behave identically.