#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# I need to know how to make dice with dots and randomly roll the dice.

edited October 2017
``````boolean a = false;
boolean b = false;
boolean c= false;
boolean d= false;
boolean e=false;
int di1 = 0;
int di2 = 0;

void setup() {
size(800, 800);
textSize(17);
}
void draw() {
background(0, 255, 255);
fill(0, 0, 0);
text("Chō-Han", 400, 100);
text("Instructions:", 400, 150);
text("1. There are two die. Click to roll and receive a random number between 1 and 6 per dice.", 400, 200);
text("2. To win, predict whether the sum of the two numbers will be even or odd.", 400, 250);
fill(255, 255, 255);
rectMode(CENTER);
rect(400, 600, 200, 100);
fill(0, 0, 0);
textAlign(CENTER);
text("START", 400, 600);
if (a ==true) {
background(150, 0, 255);
rect(300, 400, 100, 100);
rect(500, 400, 100, 100);
fill(255, 255, 255);
text("even", 300, 400);
text("odd", 500, 400);
}
if (b == true) {
background (0, 150, 255);
fill (255, 255, 255);
rect (150, 150, 200, 200);
rect (650, 150, 200, 200);
}
if (c==true) {
background (0, 0, 255);
fill (255, 255, 255);
rect (150, 550, 200, 200);
rect (650, 550, 200, 200);
}
if (d==true) {
rectMode(CENTER);
rect(400, 400, 100, 100);
fill(0, 0, 0);
textSize (20);
text ("Roll", 400, 400);
text (di1 + "and " + di2, 700, 100);
}
if (b== true && a== false && (di1 +di2) % 2 == 0) {
text("You Win", 400, 600);
}
else{
text( "You Lose", 400, 600);
}
}

void mouseClicked() {
if (a == false && b == false && mouseX>300 && mouseX<500 && mouseY>550 && mouseY<650) {
a=true;
}
if (a == true && b == false && mouseX>250 && mouseX<350 && mouseY>350 && mouseY<450) {
b =true;
a = false;
//true
}
if (a== true && b==false && c==false &&mouseX>450 && mouseX<550 && mouseY>350 && mouseY<450) {
b=false;
a =false;
c=true;
//false
}
if (b==true || c==true) {
d= true;
}
if (mouseX>350 && mouseX<450 && mouseY>350 && mouseY<450) {
e=true;
di1 = floor(random(1, 7));
di2 = floor (random(1, 7));
}
}
``````
Tagged: