# Problem with my math game

We have a project at school to make games to younger students… I thought that they would like a tablet game more than a board game so I started making my math game on Hopscotch (still way too new to Unity so I would run out of time) everything worked fine until this happened. I randomise numbers A and B and tell the system that Answer = A + B… But the problem is that the Answer variable tells what the next questions answer is… And That is WEIRD. It seems to know what it is going to randomize next and tells me that xd I am hopeless and can’t find a solution! Please help

Ya guys Nvm. Fixed it by my self. I just had my times wrong so that it would show the number before it had time to pick them… So I added some delay and changed some things. ■■■■ me.

10 Likes

Lol im making a game for younger students too.

4 Likes

i made a pythagryom therome thing to cheet on my math homework last year

3 Likes

In order for the community to try to help you, you’ll need to post your code. The best way to do that is to post a link to the project.

Without seeing the code, we can only assume you have a problem with timing / order of operations.

Obviously, the answer isn’t really predicting the next set of A & B variables. So the project must be displaying the old/previous values for A & B to go with the current answer.

Code that executes in this order:

``````Display A & B (old values)
Randomize A & B (new values)
``````

would display:

old A + old B = new answer

5 Likes

Hey! Like @ThinBuffalo said, you’d have to post your code or if possible, the entire project for the community to review. We’re always happy to help

I was just going to write more until I noticed this:

I’m glad that you fixed this, welcome to the forum and good luck presenting this to the younger student that you mentioned!

1 Like

Thank you but I solved the problem my self already. I was a bit ■■■■ making it and not realizing that they are off time… So I added some delay and everything worked as intended!

2 Likes

Thank you all for help! Even tho I figured it out my self… I understood my mistake while chatting with my dad about and DEFFINETLY learned from it. Those 45 minutes got wasted, but that happens while coding. I am so happy I found this forum because I will propably need more help in the future… maybe that on a “real” problem this time!
Have a good one.

~ Jare

2 Likes

A good way to fix bugs are to check that all of your variables are right and in the right place, and to check if your numbers are, too.

1 Like

Yup did this multiple times, but everything was good. Sadly the timing was off and had to fix that. Sometimes it is hard to jump to Hopscotch after a brake xd

2 Likes