Randomly Generating Equations
Hi, guys, I wanted to randomly spawn equations where you can input an answer. I know I am making this sound overly simple, but is there anywhere or anyone who can help me with this info. For example, after a certain event 3+4=______ would appear and then an input would be allowed to be entered. Please let me know and thank you:)
Chris
Chris
Answers
First one will be for the first number.
Second one will be for the +,-,*,/.
Third one will be for the second number.
Fourth one will be for the answer of the equation.
Fifth one will be for the player's answer.
Every time you want to generate a new equation:
Change attribute FirstNumber to random(1,100)
Change attribute SecondNumber to random(1,100)
Change attribute +,-,*,/ to random(1,4)
-If +,-,*,/ = 1 it'll be an addition
-If +,-,*,/ = 2 it'll be an subtraction
-If +,-,*,/ = 3 it'll be an multiplication
-If +,-,*,/ = 4 it'll be an division
For the Equation's answer:
-If +,-,*,/ = 1 change attribute Equation's Answer to FirstNumber+SecondNumber
-If +,-,*,/ = 2 change attribute Equation's Answer to FirstNumber-SecondNumber
-If +,-,*,/ = 3 change attribute Equation's Answer to FirstNumber*SecondNumber
-If +,-,*,/ = 4 change attribute Equation's Answer to FirstNumber/SecondNumber
To display this:
Use 3 display texts and position them accordingly
First one display FirstNumber
Second one display + if +,-,*,/ =1, - if +,-,*,/ =2, etc
Third one display SecondNumber
After the player types his answer:
If attribute Player's Answer = Equation's Answer -> Correct answer and generate new one and add points.
Hope this helps!
So instead of using a display text behaviour like i had previously said, you would follow this video to have custom numbers.
Yes make an actor that will have to be pressed to answer, either an answer box, or an ANSWER ME button, or an invisible actor that covers the whole screen except the HUD.
-In this actor make a rule, when touch is pressed, Keyboard Input and change Player'sAnswer attribute.
All the change attribute rules can indeed go in one actor.
The if statement is created by making a rule.
Here's a rules tutorial: