I need to set up my events so that if the player presses the correct order of calculations to reach the final desired number he proceeds to the next level, or if he gets the calculation wrong the level restarts.
I’m new in GDevelop so I can’t really give you a complete answer, however I’m not new to programming so maybe these steps would help you:
I guess you’d have to save in an array which objects were selected, and when the user is done selecting blocks, then extract from each element in this array the mathematical value and, if possible, evaluate the mathematical expression in order to compare it to the desired value.
When creating your level, you’d have to store, somehow, an ID of the object, or its value directly, in this array.
I’m not sure if it’s possible to evaluate a mathematical expression in GDevelop, meaning calculating the result of an expression received from user input (like the user typing 5+5 in an input, I’m not sure if GDevelop is able to do the maths for us).
If you manually build each level, then create a scene variable named “user_value” (or something like that) and then create an event for each button.
Imagine this level:
current_value = 10
desired_value = 20
the grid of possibilites:
x2 -10 /3
/4 +5 -9
x9 +9 +5
Considering you read the grid from left to right, line by line, starting at 0, then the correct answers would be: pressing BUTTON4 (adding 5 to “user_value”) and pressing BUTTON8 (also adding 5 to “user_value”).
If you make it so that when you press a button the “user_value” is modified, then you can make this work.
My first answer was a solution for creating dynamic levels, but if you create each level manually then this is fine. Forget about the array variable I mentioned in my first answer.
For another user i made keycode to open doors like a code for bank safe
Where you need to input 4 digits in correct order to open it
Code is 5 1 8 4
If you hit wrong number at it expected number for example
Instead 5 1 8
You input 5 1 7 or 5 1 3 it will reset back to expecting first digit
I was new to gdev when i was doing it so it is Frankensteins craft but it works
Go to the right stand close to spinning saw and text will appear waiting for “keys” to be input (which are just numbers 5 1 8 4)
Sure i could
But you are asking dyslectic with ADHD for doing it
I am really not best person to do it
Just to give you example
When i was young working and register in fastfood
Girl give me 20$ to pay for her food
Instead of giving her 10$ change
I gave her 100$ change
That kind of dyslexia i have
And ADHD helps me NOT be able to easily come up with ideas to solve most problems
So if no one else can solve your issue i can help but better for you to wait for some big brain here to solve it