I need help randomly generating math problems and right answers

I’m trying to make a 2,5 baldi style game in flowlab but i dont know how im gonna generate math problems and answers, they dont need to be complicated just simple plus and minus questions, and answers of course.

Wait just a bit, i’l make it for you!

Generate 2 random numbers (There is a behavior in the Logic section called Random), then put that into an Expression (Which can also be found in the Logic section).

The Expression has 2 inputs “A” and “B”, use those 2 random numbers you generated as the input for “A” and “B” (so 1 number goes to the “A” input, and the other goes to the “B” input). Inside of the Expression write ‘A-B’ or ‘A+B’.
If you then “Eval” the Expression that will give you the result of whatever you typed inside.

To allow the player to type in a number you can use the Key Press behavior and set it to ANY. Then put the “Down” output into a Text to Number behavior. This will turn the number the user types into a number (If they input a letter like q then it will output 0). (another option would be to use a Text Compare with ‘1 2 3 4, etc’ in it)

The get the number Text to Number returns and put it to the “+” input on the Text behavior.

To see if the number the user typed is equal to the number the Expression gave put both numbers through a Text Compare (Not a filter because the number the user types is technically a string of text). The number from the Expression will go into the “B” input and the number from the user will be the “A” input.

If you need any more help or would like me to give you a screenshot/make an example I can

1 Like

@Jsoft_Studios summoning (they made the Flowlab Math Game)

I made an example for you. There is a slight visual thing I’ll fix later.

I also made this relatively quickly so I’ll see about optimizing it later as well :llama:

1 Like

Thank you so much, Seriously.


hey do you know how i can start the questions when you collide with the notebook? Also how can i make it only 3 questions? im sorry im just very new.


If you look in the bundle that generates the numbers, there is a Once behavior that activates it, if you replace that with a Collision for the notebook it will work. To have it repeat only 3 times you could use a Number that gets raised by 1 each time, and when it equals 3 you no longer send the Message labeled ‘Again’

1 Like

ok that worked, but how do i make the title and the ui for the question come up when i collide with the notebook?

1 Like

The Label behavior has an “Alpha” input on it. The “Alpha” input is just the transparency of the Label. So if you set it to 0 at the start, then set it to 100 when the player collides with it that would solve your problem

Im sorry for so many questions, but how do i do that? can you give me a step by step please? again im very sorry.

1 Like

The Labels that display the Answer and your guess, has an Input on them called “Alpha”.

Alpha is the transparency of the objects (0 is invisible, 100 is fully visible)

What you want to do is have a OnceNumber (this is set to 0) → Label(The Number goes into the “Alpha” input)
That will make the text invisible

On Collision with the player, → Number(this is set to 100) → Label(The Number goes into the “Alpha” input)
This will make the text visible

EDIT: I just edited the Math bundle so it has a On and Off switch on it.