0 votes

Hi i seem to encounter this specific type called func

What is it used for?
is it important?

Godot version 3.3.2 stable
in Engine by (18 points)

2 Answers

+1 vote
Best answer

Hi,

A function is a block of code that only runs when it's called.
You can pass variables to and have variables returned from a function.
if you have some code that you need to run a number of times, instead of repeating the code, you put it in a function and call that.

You code will be a lot neater using functions.

Take a look at this GD Script Functions

by (1,865 points)
selected by
+1 vote

Hi there !
A func is short for a "function".

it's crutial in godot. In fact, it's ont of the most important thing in this engine.

A function is something that you use to tell the engine to do something.

Here is an exemple. if i want my player to die when he touches an enemy. I will create the function die and i will call it when the enemy is touched. Then, all the code that is in my func die will be put to action.

it's a really quick explanation, but I hope it helped a little.

by (46 points)
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 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 webmaster@godotengine.org with your username.