xxxxxxxxxx
81
let fortunes = [
"a bird flies into a window",
"a pendulum ceases to swing",
"a doctor can't fix that",
"a lantern fly will light the way",
"leave the Commonwealth of Pennsylvania",
"abstinence doesn't mean deprivation, trickery doesn't always mean deceipt",
"tomorrow is a good day for shoplifting",
"the pantry moth infestation will only get worse",
"'more is lost to indecision than wrong decision' - Carmela Soprano",
"do not name that which you do not want to dissappear",
"you can never go home"
];
let currentFortune = "";
function setup() {
createCanvas(400, 400);
let fortuneButton = createButton("choose a shard");
fortuneButton.position(200, 250);
fortuneButton.mousePressed(pickFortune);
let rockSmash = createButton("smash the rock");
rockSmash.position(90, 270);
}
function draw() {
background(255, 204, 0);
fill(5);
text(currentFortune, 50,100);
rect(210, 110, 150, 120, 20, 50);
if(currentFortune == fortunes[0])
triangle(48, 100, 8, 30, 36, 25);
if(currentFortune == fortunes[1])
quad(70, 160, 130, 120, 130, 150, 70, 150);
if(currentFortune == fortunes[2])
quad(30, 100, 90, 120, 90, 160, 30, 175);
if(currentFortune == fortunes[3])
ellipse(90, 150, 160, 30, 56);
if(currentFortune == fortunes[4])
rect(100, 30, 20, 55, 50, 20);
if(currentFortune == fortunes[5])
quad(70, 130, 106, 250, 90, 118, 160, 110);
if(currentFortune == fortunes[6])
rect(30, 20, 55, 50, 20, 15, 10, 5);
if(currentFortune == fortunes[7])
triangle(30, 75, 58, 20, 86, 75);
if(currentFortune == fortunes[8])
triangle(80, 79, 48, 70, 36, 55);
if(currentFortune == fortunes[9])
triangle(150, 139, 48, 210, 36, 105);
if(currentFortune == fortunes[10])
circle(50, 50, 25);
if(currentFortune == fortunes[11])
quad(50, 112, 86, 100, 50, 88, 14, 90);
}
function pickFortune(){
currentFortune= random(fortunes);
}
function drawRock(){
quad(70, 130, 106, 250, 90, 118, 160, 110);
}
//if (currentFortune == fortunes[0]){
//triangle(48, 100, 8, 30, 36, 25);
//}
//else if (currentFortune == fortunes[1]){
//quad(20, 50, 80, 30, 80, 70, 20, 70);
function pickFortune(){
currentFortune= random(fortunes);
}