what are the methods in godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lalel345

what are the methods in godot, I have seen that they mention it in the official documentation without explaining what

:bust_in_silhouette: Reply From: Ertain

Methods are the names of the computer code functions in the classes of the Godot engine. The term comes from object-oriented programming (OOP). OOP is a major part of how the Godot engine functions.

:bust_in_silhouette: Reply From: kidscancode

In programming, a function is a block of reusable code.

In object-oriented programming, a “method” is a function that’s defined in a class.

In practice, “method” and “function” are used fairly interchangeably.

so if i want to use has_method then all i need to do is

If (node_hit.has_method(“some method in the target node script”) == true:

and that method could be something like

func on_firefly_dig.

So i guess my question is if i put in “on_firefly_dig” would the has_method work?

ForgottenStar | 2021-06-30 03:14