Function abilitites in gdevelop

Hi,

Is it possible to use functions in gdevelop like languages C# or javascript?
I mean send a value to a function and the function uses it as a parameter?
Or can the function return a value?

Is there any sample of this?

regards,

Hi, to do so I usually use External Events. I enter the variables in my main scene and then put the link of external event. It uses the variables as entry and then give me back the results.

Also there is a GDevelop feature called functions. You can take a look in the wiki.
Basically you can right click on any event or group of event and extract it as a function.
I never used that, but that must be what you’d need.

2 Likes

You can create Functions that work just like built-in conditions, actions or expressions. You can also make behaviors which you assign to objects like Tween and physics.

You pass values as parameters and return them with “return …” Either as a number, string or Boolean. Functions behave just like the rest of Gdevelop with the same language and access to variables and objects.

You can also use JavaScript.

wiki:
https://wiki.gdevelop.io/gdevelop5/events/functions

2 Likes