Thursday, January 28, 2016

Find Bob


You can move around a spotlight, searching for Bob. If you can't find him, you can click anywhere to reveal the entire area.



void setup(){
size(600,600);
}

int value = 0;
int value2 = 255;

void draw(){
fill(value);
rect(0, 0, 600, 600);
fill(value2);
println(mouseX + " " + mouseY);
ellipse(mouseX,mouseY,100,100);
fill(255);
textSize(25);
text("Try to find Bob!",180,250);
textSize(10);
text("Click to reveal.",180,270);

textSize(25);
fill(0);
text("Bob",30,20);
ellipse(40,40,20,20);
strokeWeight(3);
line(40,40,40,80);

text("Larry",185,100);
ellipse(200,120,20,20);
strokeWeight(3);
line(200,130,200,160);

text("Jessica",110,280);
ellipse(130,300,20,20);
strokeWeight(3);
line(130,300,130,340);

text("Jack",435,380);
ellipse(450,400,20,20);
strokeWeight(3);
line(450,400,450,440);

text("Kim",420,260);
ellipse(430,280,20,20);
strokeWeight(3);
line(430,280,430,320);

text("Phil",370,110);
ellipse(380,130,20,20);
strokeWeight(3);
line(380,130,380,170);

text("Tina",230,400);
ellipse(240,420,20,20);
strokeWeight(3);
line(240,420,240,460);
}

void mouseClicked(){
if (value == 0) {
value = 255;
} else {
value = 0;
}
if (value2 == 255) {
value2 = 0;
} else {
value2 = 255;
}
}

void circle(int x, int y){
translate(x,y);
fill(255);
rect(0,0,mouseX,mouseY);
}

No comments:

Post a Comment