Result of math problem in string

Get help using Construct 2

Post » Mon Feb 18, 2013 12:07 pm

Hoping someone can help me out on what seems to be a simple problem.

I'm making a simple math game for kids and want to have a problem display and the answer in a random location. I figured it would be as easy as doing

question text string:
int(random(0,20))&"+"&int(random(0,20))
then a correct answer text string
int(question.TEXT)

Question displays fine but the answer only shows the first integer. How can I convert the entire string so that it gives the result?

I thought about making two sets of variables which could be put together in the question and then added together for the answer but this seems like it would become overly complicated as I start adding levels with other operands, carrying and the like.

B
10
S
2
G
3
Posts: 13
Reputation: 2,907

Post » Mon Feb 18, 2013 12:55 pm

I had made this example a long time ago.

At the time functions weren't yet implemented in C2, but this example should still work.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Mon Feb 18, 2013 1:36 pm

Great!
Seems like there should be a simpler way but it certainly helps to look though what you've done.

My seven year old son will be thrilled as well. The whole design of this game was his idea. I'll post it later. :)

Thanks.

B
10
S
2
G
3
Posts: 13
Reputation: 2,907


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests