# How do I make random generated math calculations?

Get help using Construct 2

### » Tue Sep 08, 2015 7:18 pm

Hi there!

First time posting here! Have been using Construct 2 for almost a year now. Made some entertainment games with it. (Top down shooter/roguelike, endless runner ect.)
Has been really fun, and now I am looking into serious gaming more.

I had a really cool idea for a math calculation game for the appstore, here is the example I made for you guys:

Just save it, it's too big!

Only problems is the random math calculations. It should first make a calculation, and then delete the -,+,/ or x.
This caculation Construct 2 would make can't be a complicated one at first. (Maybe for an easy level just have calculations that go till 10, and a normal one till a 100.)

I've done some crazy stuff with Construct 2, but this is too complicated for me, and there are NO tutorials for this kind of thing.

I really hope somebody could help me out.
Thank you so much!
Last edited by patrickscheper on Tue Sep 08, 2015 7:48 pm, edited 1 time in total.
B
3
Posts: 6
Reputation: 191

### » Tue Sep 08, 2015 7:33 pm

1) Save your equation to a string (equation = "45*31-187")
3) set the value of your result variable to: browser.execjs("eval("&equation&")")
result now holds the the result of your equation.

Generating random integers from x to y is done with int(random(x,y+1))

The rest should be straight forward and only limited to your creativity, no?
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

### » Tue Sep 08, 2015 10:23 pm

This was actually a response to another topic....( How do I create sprites thats contains number to operate? )

Operators.capx

but... very similar....

Operators_II.capx

B
67
S
24
G
7
Posts: 1,519
Reputation: 11,094

### » Fri Sep 11, 2015 10:54 am

Thank you guys, know how to start now!
B
3
Posts: 6
Reputation: 191