# How do I create random math formula

0 favourites
• 10 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
• Hello,

I was looking in tutorials and in forum but there was no joy, so question how do you create random math formula like this to display in a game: 5+5=10, 5*5=25 .... etc, my game will be math calculating game.

Regards,

Aurimas

• Edit: ignore, misread the OP sorry

[quote:3rmyn1y1]Local number MyVar = 0

System:Every Tick -> System: Add 5 to MyVar

Note you don't really want 'every tick', I used that as a 'placholder' event. The above will add 5 to MyVar about 60 times a second <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

Edit:

This is probably where you should start in the manual https://www.scirra.com/manual/83/variables

And also the word 'random' has many connotations, maybe 'arbitrary' would be better. Also you'll see references to 'expressions' in the manual which is what you meant by 'formula'. Good luck

• floor(random(0,10))&choose("+","-","*","etc")&floor(random(0,10))

foor is whole numbers

random is 0 to 10

choose is select either of the given options

Better to store each in variable

number1 = floor(random(0,10))

formula = choose....

number2 = floor(......

Then calculate as integar to give answer.... can't calculate text

• check what LittleStain said there.

• looks like I misinterpreted the OP He did want random equations!

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Here's a simple example of a basic math quiz.

[attachment=0:34loheig][/attachment:34loheig]

Logic is basically the same as LittleStain posted in the link roteam shared.

• Thanks, that it is what I need for my new project , just last thing in my game I will one to show correct answer in separate text box if answer was wrong, how do I add auto sum for this BasicMathQuiz.capx?

• solved it

• How did you solve?

• i did set new text box to answer every 5 seconds

• 10 posts