Hi there.
I’m only starting with GDevelop (a week worth of experience) making a simple, no animation Castle Builder game. I’ve created a simple functionality: Press the Build Farm button => Level Up a Farm building => Subtract Resources => Produce resources.
And it feels really good to be able to create that I must say!
But that took me quite a lot of time and replicating it for the other Resource buildings will take some more time now which is absolutely fine and expected… but I’m reading that apparently Functions can help speed this up.
THE PROBLEM
…is that I am already pulling my hair out (sometimes, actually, literally…) trying to understand how they work so frankly I need some help. Yes I’ve searched the forum and read the links but I’m only more and more confused how they work as I feel there is a lot of dev jargon and mental cuts.
From what I understood the idea is that in a Function would be identical to the Events logic I created already, just that it’d be using generic placeholders (equivalents to all my variables and text and images) so then depending which button is clicked (Build a Farm, Build a Woodcutter, Build an Iron Mine etc) the Function will pull in the relevant Global Variables into its logic sequence so a single Function can manage variety of functionalities in the game (in this case few buttons that level up resource buildings).
WHAT I DID
So I’ve created Parameters that are equivalents of all my Variables and Text used in my original Button creation. All the Variables that represent dynamic numbers are set as Type:Numbers, the Text that gets updated I set as Type: Object=>Text.
AND WHERE I’M STUCK
I didn’t create any Variables in this Function, as… ekhem… chatgpt told me not to, for whatever reason (but I have no idea if that’s right or not).
But now I’m stuck as it seems that how you set up functions using commands is different from how I did it with Variables because without creating Variables in the Function things like “Change the variable X: set to Y” don’t work as there are no Variables to refer to…
CALLING IN
I’ve read that there is a stage where I need to call in values into a Function so it actually works… which I think would be the next step but for now I am stuck at getting a Function to replicate the logic I created so far.
What am I doing wrong?
I’d seriously need some help of a helpful folk who could explain to me in plain English (again… plain English lol) how to use these Functions.
Thanks folks.