I’ve been trying to make small functions of reproduceable code for things in the game that I’m using a lot.
One of those things is a basic confirm function.
Here is the function I’ve made for confirm, it uses the gamepad extension:
And my events sheet showing the function
This doesn’t work, but if i replace the function with the events, it works as intended
You forgot an action in your function. You have to have the “return true” action, at minimum.
Functions, unlike external events, are not copy pasted in place of the place they are used in, they are internally real functions. That means that you have to give a return value for the engine to process. You can do that with the events in the “Functions” category.
Thank you both. I learned something new today.
I have looked at that page more than once, but I never followed the note here: Return values of functions [GDevelop wiki]
It makes functions much more interesting.
Thank you for keeping the forums clean.