# How do I Fix/Finish what I've started (Scratching my head)

Get help using Construct 2

### » Sat Feb 07, 2015 8:53 pm

HungryNoob here

Hey Guys, Need some help fixing some programming for a simple math capx, I have 3 questions pertaining to the capx file, the questions are included in the capx. I've tried a few things but being that im just learning the ropes im in need of a little help. :-/

example capx attached. would greatly appreciate it.

Thanks Guys
HungryNoob413
You do not have the required permissions to view the files attached to this post.
B
9
S
1
Posts: 18
Reputation: 518

Anybody?
B
9
S
1
Posts: 18
Reputation: 518

### » Tue Feb 10, 2015 6:22 pm

1. Should be fairly easy. Since you know the answer before hand and even if you generate it. You can have two variables one for each number. So if the basic setup is "A + B = C"

Then you can store a random number in "A" and "B"

And then you just:
"Pick random <Answer box>"
(in a variable you store the correct answer, for instant in something called "Result" and then make a Boolean as well, that will allow you to see if an <Answerbox> have been given a result, and one to mark it as the correct answer)

"Set <Answerbox>.result = A+B"
"Set <Answerbox>.Have_result = True"

For the others you can just check to see if there is already stored a result.

"Set <Answerbox>.Result = int(Random(50) + 1)"
"Set <Answerbox>.Have_result = True"

Then you can just check if the player have selected the right one. And use the result to show the player that it was correct or remove it and just write correct, whatever you need.

2. Can be done with a button where you do it all over again or you can hook it up to a timer that will make it do it again after a certain amount of time.

3. To make sure that the first number is always higher, you can just generate the second number first, and add another random to it.

"Set <First number> = <Second number> + int(random(10)+1)"
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542

### » Tue Feb 10, 2015 6:31 pm

Do you mind doing that in the capx file iv attached to tge original message? That way I can study it, and see it in action. Would appreciate it. Excuse my noobness

Thanks
B
9
S
1
Posts: 18
Reputation: 518

### » Tue Feb 10, 2015 6:49 pm

Looking at your program, ill rather not. Because I would not do it like you have done it. Meaning I would pretty much have to make it from scratch. Which I don't think would benefit you a lot, as the moment you have to expand it, you would have to agree/understand the way I did it.
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542

### » Tue Feb 10, 2015 6:59 pm

@nimos100 You welcomed do it your way, I got that code from the forums but was stuck with the things in questions, but if you could do it your way i would study it and break it down to start unddrstanding it. Either way thanks for your help. Its appreciated.
B
9
S
1
Posts: 18
Reputation: 518

### » Tue Feb 10, 2015 7:33 pm

Here is a working game.

It only uses + and - but extending it shouldn't be a problem.

Math_game.capx
You do not have the required permissions to view the files attached to this post.
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542

### » Tue Feb 10, 2015 7:49 pm

Sweet @nimos100 ill take a look now , Thanks for the help!
B
9
S
1
Posts: 18
Reputation: 518

### » Tue Feb 10, 2015 7:55 pm

Np
B
41
S
10
G
2
Posts: 1,159
Reputation: 6,542