xxxxxxxxxx
73
//curent panel saves state of comic
let currentPanel = 1;
function setup() {
createCanvas(600, 600);
}
function mousePressed() {
currentPanel = currentPanel + 1;
if (currentPanel > 5) {
currentPanel = 1;
}
}
function draw() {
background(0);
if (currentPanel == 1) {
// first panel
fill('blue')
circle(150, 250, 100)
textSize(30)
text("You have three doors", 230, 260)
}
else if (currentPanel == 2) {
// second panel
fill('red')
rect(50, 70, 100, 150);
rect(50, 235, 100, 150);
rect(50, 400, 100, 150);
textSize(25);
text('A pit of spikes', 170, 150);
text('A dragon', 170, 320);
text("A pair of lions starved for weeks", 170, 480);
}
else if (currentPanel == 3) {
// third panel
rect(50, 70, 100, 150);
rect(50, 235, 100, 150);
rect(50, 400, 100, 150);
textSize(30)
text('Which door would you choose?', 150, 50);
}
else if (currentPanel == 4) {
// fourth panel
fill('yellow');
rect(150, 250, 100);
textSize(30);
text('Spikes', 270, 310);
}
else if (currentPanel == 5) {
// fifth panel
fill('blue');
circle(150, 250, 100);
textSize(25);
text("You should've picked the last one", 220, 255);
text("since a pair of lions without food", 220, 280);
text("wouldn't survive long", 220, 305);
}
}