WTF!!!
in
Programming Questions
•
3 months ago
I honestly cant figure out what I've done wrong. I want it to present the question, wait, say the answer, then wait and start all over again.
- int time = 0;
- void setup()
- {
- size(800,300);
- frameRate(5);
- background(0);
- }
- void draw()
- {
- multiplication(12,30,500);
- }
- void multiplication(int firstnum,int secondnum,int wait)
- {
- //clear the background
- background(0);
- //Config
- textAlign(CENTER,CENTER);
- textSize(150);
- fill(255);
- rectMode(CENTER);
- //Setup numbers to multiply
- float x = random(firstnum,secondnum);
- float y = random(firstnum,secondnum);
- //Present Question
- text(int(x)+" x "+int(y),width/2,height/4);
- time = time+wait;
- while(millis()<time){}
- //Clear the background
- background(0);
- //Show answer
- text(int(x)*int(y),width/2,height/2);
- time=time+wait;
- while(millis()<time){}
- }
For some reason it just prints the answer. I would really appreciate some help.
Thanks.
1