fitkoh
October 22, 2020, 7:03pm
1
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.
1 Like
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.
2 Likes
fitkoh
October 22, 2020, 7:23pm
4
Thank you both. I learned something new today.
2 Likes
Bouh
October 23, 2020, 12:48am
5
1 Like
fitkoh
October 23, 2020, 6:04am
6
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.