/*
"Ruff Life"
SELINA MURIEL
Mayonnaise the pug is finally left alone by his owner, to seek out the sandwich that
has fallen off their table.
To move Mayonnaise, use the arrow keys!
To move the sandwich, click and hold anywhere on the screen, to drop it, leg go of
the mouse button!
Press space bar
*/
Pug myPug;
Sandwich mySandwich;
Cloud myCloud;
float sandwichX;
float sandwichY;
boolean sandwichGrabbed = false;
//colour array to organize 24 colours
color[] colorArray= {
color(177,133,58),
color(188, 140, 59),
color(167, 124, 48),
color(198, 152, 78),
color(255, 183, 116),
color(245, 155, 87),
color(252, 206, 145),
color(255, 215, 113),
color(255, 199, 149),
color(255, 220, 162),
color(222, 144, 92, 150),
color(255),
color(230),
color(250, 248, 242),
color(234, 230, 218),
color(252, 252, 252, 165),
color(191, 198, 206, 175),
color(98, 67, 58, 60),
color(240, 63, 63),
color(193, 12, 12),
color(40, 183, 39),
color(6, 90, 0),
color(255, 235, 183),
color(237, 189, 113)
};
//sentence array
String[] sentenceArray= {
"The sandwich is too big for him to eat! Mayonnaise is sad.",
"Mayonnaise really can't eat this, his mouth is too small",
"There's no way you're going to get this small pug to eat this huge sandwich. No way"
};
void setup() {
size(800, 600);
//creates new iterations of the classes - never needed to reuse the classes
myPug = new Pug();
mySandwich = new Sandwich();
myCloud = new Cloud();
}
void draw() {
ellipseMode(CENTER);
rectMode(CORNERS);
background(159, 223, 242);
//calls cloud class to display and move behind the walls but infront of the background
myCloud.display();
myCloud.update();
//Draws all the uninteractable background items
//draws the walls
fill(181, 229, 209);
noStroke();
rect(0, 0, 100, 510);
rect(0, 0, 810, 60);
rect(540, 0, 810, 510);
rect(0, 240, 800, 510);
//draws the floorbase
fill(colorArray[0]);
rect(0, 500, 810, 610);
//draws the floor boards
fill(colorArray[1]);
rect(0, 500, 120, 520);
fill(colorArray[2]);
rect(70, 520, 280, 540);
fill(colorArray[1]);
rect(0, 540, 120, 560);
fill(colorArray[2]);
rect(70, 560, 280, 580);
fill(colorArray[1]);
rect(0, 580, 120, 600);
rect(280, 520, 510, 540);
rect(280, 560, 510, 580);
fill(colorArray[2]);
rect(350, 500, 580, 520);
rect(350, 540, 580, 560);
rect(350, 580, 580, 600);
fill(colorArray[1]);
rect(580, 500, 800, 520);
rect(580, 540, 800, 560);
rect(580, 580, 800, 600);
fill(colorArray[2]);
rect(730, 520, 800, 540);
rect(730, 560, 800, 580);
//draws the bed
//draws the bed legs
fill(colorArray[3]);
rect(370, 450, 390, 505);
fill(colorArray[1]);
rect(370, 450, 390, 460);
rect(370, 450, 375, 505);
//draws the mattress
fill(colorArray[5]);
rect(-10, 430, 400, 450, 5);
//draws the blanket base
fill(colorArray[4]);
rect(-10, 300, 405, 430, 10);
//draws the stripes
fill(colorArray[7]);
rect(0, 310, 50, 320);
rect(0, 330, 50, 340);
rect(0, 350, 50, 360);
rect(0, 370, 50, 380);
rect(0, 390, 50, 400);
rect(0, 410, 50, 420);
//blanket shadow
fill(colorArray[10]);
rect(45, 300, 50, 440);
rect(50, 435, 105, 440);
rect(105, 440, 90, 430);
rect(90, 430, 400, 435);
//blanket shading
fill(colorArray[5]);
rect(90, 310, 400, 425);
fill(colorArray[4]);
rect(90, 300, 395, 420);
fill(colorArray[5]);
triangle(130, 360, 130, 420, 140, 420);
triangle(200, 360, 200, 420, 210, 420);
triangle(280, 420, 290, 420, 290, 360);
triangle(360, 420, 370, 420, 370, 360);
//blanket fold over
fill(colorArray[6]);
rect(50, 295, 100, 435, 5);
//draws the pillows
fill(colorArray[11]);
ellipse(0, 282, 100, 50);
fill(colorArray[12]);
ellipse(0, 282, 90, 40);
fill(colorArray[11]);
ellipse(0, 279, 100, 40);
//draws the blanket highlight
fill(colorArray[8]);
rect(100, 305, 390, 310);
fill(colorArray[9]);
rect(55, 305, 95, 310);
rect(90, 310, 95, 420);
//draws the window
noStroke();
fill(colorArray[13]);
rect(90, 50, 110, 250);
rect(90, 50, 550, 70);
rect(90, 230, 550, 250);
rect(530, 50, 550, 250);
//draws the window shadow
fill(colorArray[14]);
rect(95, 55, 105, 245);
rect(95, 55, 545, 65);
rect(95, 235, 545, 245);
rect(535, 55, 545, 245);
//draws the window white again
fill(colorArray[13]);
rect(100, 60, 105, 235);
rect(100, 60, 535, 65);
rect(100, 235, 535, 240);
rect(535, 60, 540, 240);
//draws the curtain
fill(colorArray[15]);
rect(90, 45, 120, 265);
rect(140, 45, 170, 265);
rect(190, 45, 210, 265);
rect(445, 45, 470, 265);
rect(485, 45, 510, 265);
rect(525, 45, 550, 265);
//draws the curtain highlights
rect(100, 55, 110, 255);
rect(150, 55, 160, 255);
rect(195, 55, 205, 255);
rect(455, 55, 460, 255);
rect(495, 55, 500, 255);
rect(535, 55, 540, 255);
//draws the curtain fold
fill(colorArray[16]);
rect(120, 45, 140, 260);
rect(170, 45, 190, 260);
rect(470, 45, 485, 260);
rect(510, 45, 525, 260);
//draws the curtain shadow in the fold
rect(120, 45, 125, 260);
rect(170, 45, 175, 260);
rect(470, 45, 475, 260);
rect(510, 45, 515, 260);
rect(135, 45, 140, 260);
rect(185, 45, 190, 260);
rect(480, 45, 485, 260);
rect(520, 45, 525, 260);
//draws the stool legs
fill(colorArray[3]);
rect(440, 510, 430, 440, 10);
rect(470, 510, 480, 440, 10);
//draws the stool thick cushion
fill(colorArray[11]);
rect(410, 450, 500, 465, 10);
//draws the stool cushion shadow
fill(colorArray[12]);
rect(410, 400, 500, 458, 20);
//draws the stool thick cusion
fill(colorArray[11]);
rect(410, 400, 500, 455, 20);
//draws the stool button
fill(colorArray[12]);
ellipse(455, 400, 10, 5);
//draws the back of table
fill(colorArray[2]);
rect(640, 280, 800, 450);
//draws the table leg
fill(colorArray[0]);
rect(620, 280, 640, 505);
//draws the shadow
fill(colorArray[17]);
rect(620, 280, 640, 287);
rect(620, 280, 640, 297);
rect(640, 280, 800, 450);
rect(640, 280, 650, 450);
rect(650, 280, 800, 290);
//draws the tabletop
fill(colorArray[1]);
rect(550, 260, 570, 290);
rect(550, 260, 800, 280);
//draws the table highlights
fill(colorArray[3]);
rect(620, 310, 625, 500);
rect(555, 265, 560, 280);
rect(555, 265, 805, 270);
//calls the pug and sanwich to display
myPug.display();
mySandwich.display();
//calls the sandwich to do the movements
mySandwich.update();
}
//makes you be able to move the pug with the left and right arrow keys
int stringNum = 0;
void keyPressed()
{
if (keyCode == LEFT){
myPug.move(- 5);
} else if (keyCode == RIGHT){
myPug.move(+ 5);
} if (keyCode == ' '){
println(sentenceArray[stringNum]);
stringNum = (stringNum > 1) ? 0 : stringNum + 1;
}
}