Math Equation from Variables

For questions about using Classic.

Post » Sun May 02, 2010 10:50 pm

Hello! So, I'm trying to make a math game, and it's sort of like a calculator program right now. Basically, the player is given an equation, and must use an operator combined with 4 randomly generated numbers to a set value (200) until it is equal to the given equation. For example, if the problem were 10 * 10 = __, and the player uses /2, then 200/2 = 100 and they win.

The way I'm doing the user interface, when the user clicks on an operator, it is sent to a global variable as a text. So if they clicked on +, global variable 'operator' is equal to "+". When they click on the "GO" button, it should submit the current operator and the current value into an equation.

So the problem is that I don't know how to combine these into an equation that construct understands. I tried to do:
On Button clicked:
System: set global variable 'answer' to global('answer'), global('operator'), global('value')
Text22: set text to global('answer')

Program can be found here: http://dl.dropbox.com/u/4055367/arithimagic.cap
B
2
G
2
Posts: 17
Reputation: 684

Post » Mon May 03, 2010 2:25 am

you're going to have to do it manually I would assume
so
global('operator') equal to "+"
----set global('answer') to global('answer')+global('value')

global('operator') equal to "-"
----set global('answer') to global('answer')-global('value')

etc..
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Mon May 03, 2010 6:29 pm

Aww, that's unfortunate. Ah well! Thanks!
B
2
G
2
Posts: 17
Reputation: 684


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests