Created
September 24, 2012 18:01
-
-
Save sarahrothberg/3777325 to your computer and use it in GitHub Desktop.
the color part that doesn't work is down in the drawMold function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @pjs preload= "bathroom.jpeg"; */ | |
PImage bathroom; | |
PImage bleachCan; | |
Mold aMold; | |
Mold bMold; | |
Mold cMold; | |
Mold dMold; | |
Mold eMold; | |
Mold fMold; | |
Mold gMold; | |
Mold hMold; | |
Mold iMold; | |
Mold jMold; | |
Mold kMold; | |
Mold lMold; | |
int click = 0; | |
String speechOne = "Woah it's like totally \n gnar-gnar in here!"; | |
String speechTwo = "Click and drag to \n BLEEEAAAACH THE MOLD!"; | |
String speechThree = "OH NO I DIED!"; | |
String theMoldAlwaysWins= "THE MOLD\n ALWAYS\n WINS"; | |
int clickedTime; | |
void setup() { | |
size(600, 490); | |
bathroom = loadImage("bathroom.jpeg"); | |
bleachCan = loadImage("bleach.jpeg"); | |
image(bathroom, 0, 0); | |
frameRate(200); | |
aMold = new Mold(330, 209, 77, 209, 320, 405);//tilesMold | |
bMold = new Mold(330, 468, 444, 500, 289, 411);//rugMold | |
cMold = new Mold( 154, 140, 20, 153, 143, 194);//mirrorMold | |
dMold = new Mold( 150, 145, 20, 153, 143, 194);//mirrorMold2 | |
eMold = new Mold(330, 470, 444, 500, 289, 411);//rugMold2 | |
fMold = new Mold( 340, 217, 77, 209, 320, 405);//tilesMold2 | |
gMold = new Mold( 0, 500, 453, 490, 0, 470);//frontMold | |
hMold = new Mold(5, 498, 543, 490, 0, 470);//frontMold2 | |
iMold = new Mold( 530, 116, 85, 140, 520, 560);//faceMold | |
jMold = new Mold( 500, 375, 301, 374, 281, 504);//tubMold | |
kMold = new Mold ( 3, 23, 23, 188, 3, 88);//curtainMold | |
lMold = new Mold ( 21, 365, 280, 360, 0, 20);//toiletMold | |
} | |
void draw() { | |
aMold.drawMold(); | |
bMold.drawMold(); | |
cMold.drawMold(); | |
dMold.drawMold(); | |
eMold.drawMold(); | |
fMold.drawMold(); | |
gMold.drawMold(); | |
hMold.drawMold(); | |
if (millis()>=2000) { | |
noStroke(); | |
fill(255); | |
ellipse(435, 35, 240, 70); | |
ellipse(535, 62, 10, 10); | |
ellipse(540, 74, 8, 8); | |
fill(0); | |
textSize(14); | |
text(speechOne, 340, 27); | |
jMold.drawMold(); | |
} | |
if (millis()>=8000) { | |
kMold.drawMold(); | |
lMold.drawMold(); | |
textSize(14); | |
noStroke(); | |
noStroke(); | |
fill(255); | |
ellipse(435, 35, 240, 70); | |
ellipse(535, 62, 10, 10); | |
ellipse(540, 74, 8, 8); | |
fill(0); | |
text(speechTwo, 340, 27); | |
image(bleachCan, 300, 300); | |
drawBleach(); | |
} | |
if (click>=1&&7000<millis()-clickedTime) { //this was a cool way to make something happen after a click but it ende up not being useful | |
// if (millis()>=16000) { | |
iMold.drawMold(); | |
textSize(14); | |
fill(255); | |
ellipse(435, 35, 240, 70); | |
fill(0); | |
text(speechThree, 340, 27); | |
textSize(100); | |
fill(random(20), random(255), random(90)); | |
pushMatrix(); | |
translate(random(-20), random(20)); | |
translate(random(20), random(-20)); | |
text(theMoldAlwaysWins, 70, 70); | |
popMatrix(); | |
} | |
aMold.drawMold(); | |
bMold.drawMold(); | |
cMold.drawMold(); | |
dMold.drawMold(); | |
eMold.drawMold(); | |
fMold.drawMold(); | |
} | |
void mousePressed(){ | |
click++; | |
clickedTime = millis(); | |
} | |
class Mold { | |
//color c; | |
float moldPositionX; | |
float moldPositionY; | |
float upperLimit; | |
float lowerLimit; | |
float leftLimit; | |
float rightLimit; | |
Mold (/*color tempC,*/ float tempPositionX, float tempPositionY, float tempUpperLimit, | |
float tempLowerLimit, float tempLeftLimit, float tempRightLimit) { | |
/*c = tempC;*/ | |
moldPositionX = tempPositionX; | |
moldPositionY = tempPositionY; | |
upperLimit = tempUpperLimit; | |
lowerLimit = tempLowerLimit; | |
leftLimit = tempLeftLimit; | |
rightLimit = tempRightLimit; | |
} | |
void drawMold() { | |
// if (keyPressed) { | |
stroke(0, (random(200)), 0, 1); | |
strokeWeight(10); | |
point(moldPositionX, moldPositionY); | |
moldPositionX = moldPositionX + random(-.8, .8); | |
moldPositionY = moldPositionY+ random(-.8, .8); | |
moldPositionX=min(rightLimit, moldPositionX); | |
moldPositionX=max(leftLimit, moldPositionX); | |
moldPositionY=min(lowerLimit, moldPositionY); | |
moldPositionY=max(upperLimit, moldPositionY); | |
/*if(moldPositionX<leftLimit||moldPositionX>rightLimit|| | |
moldPositionY<upperLimit||moldPositionY>lowerLimit){ | |
moldPositionX=leftLimit;*/ | |
} | |
} | |
void drawBleach() { | |
if (mousePressed) { | |
pushMatrix(); | |
stroke(255); | |
strokeWeight(2) ; | |
fill(0); | |
point(mouseX, mouseY); | |
translate(random(-20), random(20)); | |
point(mouseX, mouseY); | |
translate(random(20), random(-20)); | |
point(mouseX, mouseY); | |
translate(random(-20), random(20)); | |
point(mouseX, mouseY); | |
translate(random(20), random(-20)); | |
point(mouseX, mouseY); | |
popMatrix(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment