xxxxxxxxxx
352
let img;
function setup() {
createCanvas(520, 450);
}
function draw() {
background(251, 255, 0);
fill(0);
noStroke();
rect(30, 0, 520, 10); //1 top border
rect(0, 440, 520, 10); //3 bottom border
rect(0, 50, 10, 490); //4 left border
rect(510, 0, 10, 400); //2 right border
rect(0, 50, 60, 10); //5
rect(0, 140, 60, 10); //6
rect(0, 400, 100, 10); //7
rect(100, 50, 60, 10); //8
rect(100, 50, 10, 140); //9
rect(150, 50, 10, 140); // 10
rect(50, 95, 50, 10); //11
rect(50, 180, 50, 10); //12
rect(50, 180, 10, 100); //13
rect(50, 230, 150, 10); //14
rect(50, 320, 10, 50); //15
rect(100, 370, 10, 40); //16
rect(50, 320, 100, 10); //17
rect(150, 275, 10, 165); //18
rect(100, 275, 50, 10); //19
rect(200, 360, 10, 80); //20
rect(200, 230, 10, 80); //21
rect(210, 300, 50, 10); //22
rect(210, 180, 50, 10); //23
rect(210, 0, 10, 190); //24
rect(250, 230, 10, 170); //25
rect(250, 230, 70, 10); //26
rect(310, 90, 10, 150); //27
rect(260, 130, 50, 10); //28
rect(260, 50, 10, 80); //29
rect(310, 0, 10, 40); //30
rect(310, 40, 100, 10); //31
rect(310, 90, 200, 10); //32
rect(455, 50, 10, 40); //33
rect(310, 180, 50, 10); //34
rect(350, 135, 120, 10); //35
rect(410, 140, 10, 150); //36
rect(370, 230, 40, 10); //37
rect(305, 280, 105, 10); //38
rect(305, 285, 10, 115); //39
rect(305, 390, 145, 10); //40
rect(445, 390, 10, 50); //41
rect(460, 135, 10, 100); //42
rect(460, 280, 50, 10); //43
rect(355, 285, 10, 60); //44
rect(355, 340, 100, 10); //45
//red square
fill(255, 0, 0);
square(mouseX, mouseY, 25);
if (mouseY < 10 && mouseX + 25 > 30) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //1
if (mouseX + 25 > 510) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //2
if (mouseY + 25 > 440) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //3
if (mouseX < 10 && mouseY + 25 > 61) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //4
if (mouseX < 60 && mouseY + 25 > 50 && mouseY < 60) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //5
if (mouseX < 60 && mouseY + 25 > 140 && mouseY < 150) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //6
if (mouseX < 100 && mouseY + 25 > 400 && mouseY < 410) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //7
if (mouseX + 25 > 100 && mouseX < 160 && mouseY + 25 > 50 && mouseY < 60) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //8
if (mouseX + 25 > 100 && mouseX < 110 && mouseY + 25 > 60 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //9
if (mouseX + 25 > 150 && mouseX < 160 && mouseY + 25 > 60 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //10
if (mouseX + 25 > 50 && mouseX < 100 && mouseY + 25 > 95 && mouseY < 105) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //11
if (mouseX + 25 > 50 && mouseX < 100 && mouseY + 25 > 180 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //12
if (mouseX + 25 > 50 && mouseX < 60 && mouseY + 25 > 190 && mouseY < 280) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //13
if (mouseX + 25 > 60 && mouseX < 210 && mouseY + 25 > 230 && mouseY < 240) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //14
if (mouseX + 25 > 50 && mouseX < 60 && mouseY + 25 > 320 && mouseY < 370) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //15
if (mouseX + 25 > 100 && mouseX < 110 && mouseY + 25 > 370 && mouseY < 410) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //16
if (mouseX + 25 > 60 && mouseX < 140 && mouseY + 25 > 320 && mouseY < 330) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //17
if (mouseX + 25 > 150 && mouseX < 160 && mouseY + 25 > 275 && mouseY < 440) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //18
if (mouseX + 25 > 100 && mouseX < 140 && mouseY + 25 > 275 && mouseY < 285) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //19
if (mouseX + 25 > 200 && mouseX < 210 && mouseY + 25 > 360 && mouseY < 440) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //20
if (mouseX + 25 > 200 && mouseX < 210 && mouseY + 25 > 240 && mouseY < 310) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //21
if (mouseX + 25 > 210 && mouseX < 250 && mouseY + 25 > 300 && mouseY < 310) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //22
if (mouseX + 25 > 220 && mouseX < 260 && mouseY + 25 > 180 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //23
if (mouseX + 25 > 210 && mouseX < 220 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //24
if (mouseX + 25 > 250 && mouseX < 260 && mouseY + 25 > 230 && mouseY < 400) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //25
if (mouseX + 25 > 260 && mouseX < 320 && mouseY + 25 > 230 && mouseY < 240) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //26
if (mouseX + 25 > 310 && mouseX < 320 && mouseY + 25 > 90 & mouseY < 230) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //27
if (mouseX + 25 > 260 && mouseX < 300 && mouseY + 25 > 130 && mouseY < 140) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //28
if (mouseX + 25 > 260 && mouseX < 270 && mouseY + 25 > 50 && mouseY < 130) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //29
if (mouseX + 25 > 310 && mouseX < 320 && mouseY < 50) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //30
if (mouseX + 25 > 330 && mouseX < 410 && mouseY + 25 > 40 && mouseY < 50) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //31
if (mouseX + 25 > 320 && mouseY + 25 > 90 && mouseY < 100) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //32
if (mouseX + 25 > 455 && mouseX < 465 && mouseY + 25 > 50 && mouseY < 90) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //33
if (mouseX + 25 > 320 && mouseX < 360 && mouseY + 25 > 180 && mouseY < 190) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //34
if (mouseX + 25 > 350 && mouseX < 470 && mouseY + 25 > 135 && mouseY < 145) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //35
if (mouseX + 25 > 410 && mouseX < 420 && mouseY + 25 > 145 && mouseY < 290) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //36
if (mouseX + 25 > 370 && mouseX < 410 && mouseY + 25 > 230 && mouseY < 240) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //37
if (mouseX + 25 > 315 && mouseX < 400 && mouseY + 25 > 280 && mouseY < 290) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //38
if (mouseX + 25 > 305 && mouseX < 315 && mouseY + 25 > 280 && mouseY < 400) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //39
if (mouseX + 25 > 315 && mouseX < 455 && mouseY + 25 > 390 && mouseY < 400) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //40
if (mouseX + 25 > 445 && mouseX < 455 && mouseY + 25 > 400 && mouseY < 450) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //41
if (mouseX + 25 > 460 && mouseX < 470 && mouseY + 25 > 145 && mouseY < 245) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //42
if (mouseX + 25 > 460 && mouseX < 510 && mouseY + 25 > 280 && mouseY < 290) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //43
if (mouseX + 25 > 355 && mouseX < 365 && mouseY + 25 > 290 && mouseY < 350) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //44
if (mouseX + 25 > 365 && mouseX < 455 && mouseY + 25 > 340 && mouseY < 350) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('OUCH!', 160, 220);
} //45
if (mouseX + 25 > 425 && mouseY > 370) {
rect(0, 0, width, height);
fill(251, 255, 0);
textSize(60);
text('YOU WON!!!', 160, 220);
}
}