I can’t figure out why the dots aren’t being drawn after the random variable is decided. Please help. The point is to make the die “roll around” 7 times slower each time, and then stopping.
//LED Dice Virtual Simulation By Harie, Xiang, Michael, Muhammed
float r = 6;
int rr = 6;
int d = 300;
void setup() {
size(500, 500);
background(0, 255, 255);
}
void draw() {
fill(255, 0, 0);
ellipse(250, 35, 30, 30);
}
void mousePressed() {
float distance = dist(mouseX, mouseY, 250, 35);
if (distance < 15) {
for (int i = 0; i < 7; i++){
d = d + 200;
delay(d);
r = random(5);
rr = round(r);
println(rr);
draw();
if(rr == 0) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(250, 250, 50, 50);
delay(d);
} else if (rr == 1) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(400, 100, 50, 50);
ellipse(100, 400, 50, 50);
} else if (rr == 2) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(100, 100, 50, 50);
ellipse(250, 250, 50, 50);
ellipse(400, 400, 50, 50);
} else if (rr == 3) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(100, 100, 50, 50);
ellipse(100, 400, 50, 50);
ellipse(400, 100, 50, 50);
ellipse(400, 400, 50, 50);
} else if (rr == 4) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(100, 100, 50, 50);
ellipse(100, 400, 50, 50);
ellipse(400, 100, 50, 50);
ellipse(400, 400, 50, 50);
ellipse(250, 250, 50, 50);
} else if (rr == 5) {
//draw();
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(0);
ellipse(100, 100, 50, 50);
ellipse(100, 400, 50, 50);
ellipse(400, 100, 50, 50);
ellipse(400, 400, 50, 50);
ellipse(100, 250, 50, 50);
ellipse(400, 250, 50, 50);
} else {
fill(255);
rect(10, 10, 480, 480, 10/5);
fill(255, 0, 0);
ellipse(250, 100, 30, 30);
}
}
} else{
r = 6;
}
}