Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
///Cat Babushka (Babushcat)
///by Colton David
///for Nicolas Hesler
///~Ask Babushcat for advice on life, love, and cat stuff~
///all advice excerpts provided by Maria Stavreva, a real slavic grandma.

//Love Button Var
float loveButtonX1 = 270;
float loveButtonY1 = 30;
float loveButtonX2 = 390;
float loveButtonY2 = 90;
//Cat Button Var
float catButtonX1 = 270;
float catButtonY1 = 120;
float catButtonX2 = 390;
float catButtonY2 = 180;
//Job Button Var
float jobButtonX1 = 270;
float jobButtonY1 = 210;
float jobButtonX2 = 390;
float jobButtonY2 = 270;
//Colours
int furColour = 180;
//Drawing Vars
int hoodXPos = 130;
int hoodYPos = 160;
int hoodWidth = 200;
int hoodHeight = 200;
int patternSpaceX = 0;
int patternSpaceY = 0;
int leftpupilXPos = 105;
int leftpupilYPos = 145;
int rightpupilXPos = 175;
int rightpupilYPos = 145;
float leftMouthX = 120;
float leftMouthY = 190;
float rightMouthX = 140;
float rightMouthY = 190;

//Logic Vars
int textX = 200;
int textY = 355;
boolean loveButtonpress = false;
boolean catButtonpress = false;
boolean jobButtonpress = false;
int loveTest = 0;
int catTest = 0;
int jobTest = 0;


void setup() {
  size(400, 400);
  background(145, 51, 42);
  rectMode(CORNERS);
  noStroke();
  textAlign(CENTER);
  textSize(24);
}

void draw() {
  frameRate(60);
  stroke(0);
  strokeWeight(2);
  drawBackground();
  drawLoveButton();
  drawJobButton();
  drawCatButton();
  drawCatGrandma();
  drawTable();

  noStroke(); //Cancel stroke for text hide
}
void mouseClicked() {
  //Check if clicking Love Box
  if (mouseX > loveButtonX1 && mouseX < loveButtonX1+loveButtonX2 && mouseY > loveButtonY1 && mouseY < loveButtonY1+loveButtonY2-30) {
    loveButtonpress = true;
    //Print love response in 1 - 10 order, repeat when finished
    if (loveButtonpress == true) {
      loveTest = loveTest+1;
      if (loveTest > 10) {
        loveTest = 1;
      }
      if (loveTest == 1) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("A person who is totally free,", textX, textY);
        text ("is a person who needs no one.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 2) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("You don't really know someone until", textX, textY);
        text("you've eaten a bag of salt together.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 3) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Honesty and truth are expensive gifts", textX, textY);
        text("that you can't expect from cheap people.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 4) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("In friendship and in love", textX, textY);
        text("no one is in debt.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 5) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("When you are in love, make sure you", textX, textY);
        text("are both looking in the same direction.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 6) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Love each other", textX, textY);
        text(" like the first day you met.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 7) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Love must be shared, not hoarded.", textX, textY);
        rectMode(CORNERS);
      }
      if (loveTest == 8) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Salt your water before you boil it.", textX, textY);
        rectMode(CORNERS);
      }
      if (loveTest == 9) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Your time has value", textX, textY);
        text("and so does your partner's.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (loveTest == 10) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Eating together makes food taste better.", textX, textY);
        rectMode(CORNERS);
      }
    }
  }
  //Check if clicking Cat Box
  if (mouseX > catButtonX1 && mouseX < catButtonX1+catButtonX2 && mouseY > catButtonY1 && mouseY < catButtonY1+catButtonY2-120) {
    catButtonpress = true;
    if (catButtonpress == true) {
      catTest = catTest+1;
      if (catTest > 10) {
        catTest = 1;
      }
      if (catTest == 1) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("May God save you from your friends.", textX, textY);
        text ("You can save yourself from enemies.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (catTest == 2) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Be independent but stay close", textX, textY);
        text(" to the ones you love.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (catTest == 3) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Honesty and truth are expensive gifts", textX, textY);
        text("that you can't expect from cheap people.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (catTest == 4) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Check your beans for stones", textX, textY);
        text(" before you boil them.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (catTest == 5) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Without your health", textX, textY);
        text(" you have nothing.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (catTest == 6) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("You are the best cat in this world.", textX, textY);
        rectMode(CORNERS);
      }
      if (catTest == 7) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Be grateful for your parents.", textX, textY);
        rectMode(CORNERS);
      }
      if (catTest == 8) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Don't go where you are not meant to be.", textX, textY);
        rectMode(CORNERS);
      }
      if (catTest == 9) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("You are the best cat in this world.", textX, textY);
        rectMode(CORNERS);
      }
      if (catTest == 10) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Don't climb the table, people eat there.", textX, textY);
        rectMode(CORNERS);
      }
    }
  }
  //Check if clicking Job Box
  if (mouseX > jobButtonX1 && mouseX < jobButtonX1+jobButtonX2 && mouseY > jobButtonY1 && mouseY < jobButtonY1+jobButtonY2-210) {
    jobButtonpress = true;
    if (jobButtonpress == true) {
      jobTest = jobTest+1;
      if (jobTest > 10) {
        jobTest = 1;
      }
      if (jobTest == 1) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(20);
        text ("Everything good is only good", textX, textY);
        text ("in its time and place.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (jobTest == 2) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Even in the meowst difficult times,", textX, textY);
        text ("believe you will survive.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (jobTest == 3) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Always forgive others.", textX, textY);
        rectMode(CORNERS);
      }
      if (jobTest == 4) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Only do what brings you joy.", textX, textY);
        rectMode(CORNERS);
      }
      if (jobTest == 5) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Meowney is important", textX, textY);
        text ("but do not bank on happiness.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (jobTest == 6) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Some values never die.", textX, textY);
        rectMode(CORNERS);
      }
      if (jobTest == 7) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("It's ok that you are a failure,", textX, textY);
        text ("that's why your parents had more kids.", textX, textY+25);
        rectMode(CORNERS);
      }
      if (jobTest == 8 ) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Go for the job that chose you.", textX, textY);
        rectMode(CORNERS);
      }
      if (jobTest == 9) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(22);
        text ("Get out of bed right now.", textX, textY);
        rectMode(CORNERS);
      }
      if (jobTest == 10) {
        rectMode(CENTER);
        fill(145, 51, 42);
        rect (textX, textY, 400, 100);
        fill(255);
        textSize(19);
        text ("Come out of your house with misery,", textX, textY);
        text ("return with misery.", textX, textY+25);
        rectMode(CORNERS);
      }
    }
  }
  //Random Meow
  if (mouseX > 30 && mouseX < 280 && mouseY > 50 && mouseY < 300) {
    textSize(22);
    fill (255);
    strokeWeight(2);
    text("meow", random(30, 280), random(50, 300)); 
    frameRate(3);
  }
}


void drawLoveButton() {
  stroke(0);
  //Draw love button
  fill(200);
  //Mouse-over feedback
  if (mouseX > loveButtonX1 && mouseX < loveButtonX1+loveButtonX2 && mouseY > loveButtonY1 && mouseY < loveButtonY1+loveButtonY2-30) {
    fill(255);
  }
  rect(loveButtonX1, loveButtonY1, loveButtonX2, loveButtonY2, 10);
  fill(0);
  //L
  line(290, 40, 290, 80);
  line(290, 80, 310, 80);
  //U
  line(320, 50, 320, 80);
  line(320, 80, 340, 80);
  line(340, 80, 340, 50);
  //V
  line(350, 50, 360, 80);
  line(360, 80, 370, 50);
}

//Draw cat button
void drawCatButton() {
  fill(200);
  //Mouse-over feedback
  if (mouseX > catButtonX1 && mouseX < catButtonX1+catButtonX2 && mouseY > catButtonY1 && mouseY < catButtonY1+catButtonY2-120) {
    fill(255);
  }
  rect(catButtonX1, catButtonY1, catButtonX2, catButtonY2, 10);
  fill(0);
  //C
  line(310, 130, 290, 150);
  line(290, 150, 310, 170);
  //A
  line(330, 140, 320, 170);
  line(330, 140, 340, 170);
  line(325, 160, 335, 160);
  //T
  line(350, 140, 370, 140);
  line(360, 140, 360, 170);
}

//Draw job button
void drawJobButton() {
  fill(200);
  //Mouse-over feedback
  if (mouseX > jobButtonX1 && mouseX < jobButtonX1+jobButtonX2 && mouseY > jobButtonY1 && mouseY < jobButtonY1+jobButtonY2-210) {
    fill(255);
  }
  rect(jobButtonX1, jobButtonY1, jobButtonX2, jobButtonY2, 10);
  fill(0);
  //J
  line(290, 220, 310, 220);
  line(300, 220, 300, 260);
  line(300, 260, 290, 250);
  //O
  line(320, 230, 340, 230);
  line(340, 230, 340, 260);
  line(340, 260, 320, 260);
  line(320, 260, 320, 230);
  //B
  line(350, 230, 350, 260);
  line(350, 230, 370, 240);
  line(370, 240, 350, 250);
  line(350, 250, 370, 260);
  line(370, 260, 350, 260);
}

void drawCatGrandma() {
  noStroke();
  ellipseMode(CENTER);
  //Ears
  fill(furColour);
  triangle(30, 60, 95, 80, 60, 120);
  triangle(230, 60, 145, 80, 200, 120);
  //Body
  ellipse(hoodXPos, hoodYPos+80, hoodWidth-20, hoodHeight-10);
  fill(252, 199, 194);
  ellipse(hoodXPos, hoodYPos+80, hoodWidth-40, hoodHeight-30);
  //Apron Pattern
  for (patternSpaceX=100; patternSpaceX < 170; patternSpaceX = patternSpaceX + 10) {
    for (patternSpaceY = 80; patternSpaceY < 320; patternSpaceY = patternSpaceY + 10) {
      fill(255, 0, 0);
      ellipse(patternSpaceX, patternSpaceY, 4, 4);
    }
  }
  //Neckerchief
  fill(200, 0, 0);
  rotate(0.5);  //rotating is hard ; _ ;
  ellipse(225, 175, 30, 50);
  rotate(-1);
  ellipse(5, 300, 30, 50); //there is no logic here ; _ ;
  rotate(0.5);
  //Hood
  fill(220, 40, 40);
  ellipse(hoodXPos, hoodYPos, hoodWidth, hoodHeight);
  //Fur Fluffs
  fill(furColour + 30);
  ellipse(65, 185, 40, 40);
  ellipse(85, 205, 40, 40);
  ellipse(195, 185, 40, 40);
  ellipse(175, 205, 40, 40);
  //Face
  fill(furColour);
  ellipse(130, 160, 150, 140);
  //Eyes
  fill(255);
  ellipse(95, 145, 40, 30); //Left white
  ellipse(165, 145, 40, 30); //Right white
  fill(0);
  //Look at Player
  if (loveButtonpress == true || catButtonpress == true || jobButtonpress == true) {
    ellipse (leftpupilXPos-10, leftpupilYPos, 10, 22); //Left pupil
    ellipse (rightpupilXPos-10, rightpupilYPos, 10, 22); //Right pupil
  } else {
    //Look at Questions
    ellipse (leftpupilXPos, leftpupilYPos, 20, 22); //Left pupil
    ellipse (rightpupilXPos, rightpupilYPos, 20, 22); //Right pupil
  }
  //Eyebrows
  fill(120);
  rect(80, 110, 110, 125, 15);
  rect(152, 110, 182, 125, 15);
  //Nose
  triangle(120, 160, 140, 160, 130, 178);
  //Mouth
  stroke(0);
  strokeWeight(1.5);
  if (loveButtonpress == true || catButtonpress == true || jobButtonpress == true) {
    line(130, 176, leftMouthX -5, leftMouthY); //Left Mouth
    line(130, 176, rightMouthX+5, rightMouthY); //Right Mouth
    fill(252, 199, 194);
    noStroke();
    triangle(130, 178, leftMouthX-2, leftMouthY, rightMouthX+3, rightMouthY);
  } else {
    line(130, 176, leftMouthX, leftMouthY); //Left Mouth
    line(130, 176, rightMouthX, rightMouthY); //Right Mouth
  }
  //Wrinkles
  stroke(0);
  line(70, 165, 90, 165);
  line(70, 175, 90, 175);
  line(170, 165, 190, 165);
  line(170, 175, 190, 175);
  //Hood Jewel
  fill(255, 0, 0);
  noStroke();
  ellipse(hoodXPos, 245, 25, 30);
}

//Hide the bottom of Babushcat
void drawTable() {
  fill(145, 51, 42);
  rect(0, 300, 400, 335);
}

//Draw updating background
void drawBackground() {
  fill(255, 80, 80);
  rect(-20, -20, 450, 300);
  for (float bgSpot = 30; bgSpot < 400; bgSpot = bgSpot + 25) {
    fill (145, 51, 42);
    noStroke();
    ellipse(bgSpot, 0, 5, bgSpot);
  }
}

//fin