0 votes

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

in Engine by (196 points)

2 Answers

0 votes

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.

by (3,162 points)
+1 vote

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.

by (22,069 points)

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

If (nodehit.hasmethod("some method in the target node script") == true:

and that method could be something like

func onfireflydig.

So i guess my question is if i put in "onfireflydig" would the has_method work?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.