Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Maxlaughter |
Hi i seem to encounter this specific type called func
What is it used for?
is it important?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Maxlaughter |
Hi i seem to encounter this specific type called func
What is it used for?
is it important?
Reply From: | dany_pitre |
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.
Reply From: | deaton64 |
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