xxxxxxxxxx
320
//scenes
let scene1 = true;
let scene2 = false;
let scene3 = false;
let scene4 = false;
let scene5 = false;
let scene6 = false;
let scene7 = false;
let scene8 = false;
let scene9 = false;
let scene10 = false;
let scene11 = false;
let scene12 = false;
let scene13 = false;
let scene14 = false;
let scene15 = false;
//images
let start;
let keepGoing;
let flash;
let rollDown;
let speedChase;
let avoid;
let gate;
let stopOnRoad;
let hurtSquirrel;
let takeInCar;
let attack;
let pickUp;
function preload() {
start = loadImage("scenes/scene_1.png");
keepGoing = loadImage("scenes/scene_2.1_3.png");
flash = loadImage("scenes/scene_2.8.png");
rollDown = loadImage("scenes/scene_2.6.png");
speedChase = loadImage("scenes/scene_2.7.png");
avoid = loadImage("scenes/scene_2.4.png");
gate = loadImage("scenes/scene_2.5.png");
stopOnRoad = loadImage("scenes/scene_2.0.png");
hurtSquirrel = loadImage("scenes/scene_2.5_1.png");
takeInCar = loadImage("scenes/scene_2.2_1.png");
attack = loadImage("scenes/scene_2.2.png");
pickUp = loadImage("scenes/scene_2.3_1.png");
}
function setup() {
createCanvas(800, 800);
start.loadPixels();
keepGoing.loadPixels();
flash.loadPixels();
rollDown.loadPixels();
speedChase.loadPixels();
avoid.loadPixels();
gate.loadPixels();
stopOnRoad.loadPixels();
hurtSquirrel.loadPixels();
takeInCar.loadPixels();
attack.loadPixels();
pickUp.loadPixels();
}
function draw() {
if (scene1 == true) {
firstScene();
} else if (scene2 == true) {
secondScene();
} else if (scene3 == true) {
thirdScene();
} else if (scene4 == true) {
fourthScene();
} else if (scene5 == true) {
fifthScene();
} else if (scene6 == true) {
sixthScene();
} else if (scene7 == true) {
seventhScene();
} else if (scene8 == true) {
eighthScene();
} else if (scene9 == true) {
ninthScene();
} else if (scene10 == true) {
tenthScene();
} else if (scene11 == true) {
eleventhScene();
} else if (scene12 == true) {
twelfthScene();
} else if (scene13 == true) {
thirteenthScene();
} else if (scene14 == true) {
fourteenthScene();
} else if (scene15 == true) {
fifteenthScene();
}
// text("mouse x: "+mouseX+" mouse y: "+mouseY, width/2,height-30);
}
function firstScene() {
background(255);
image(start, 0, 0);
fill(255);
rect(25,350,80,80);
rect(625,350,80,80);
fill(0);
textSize(12);
text("Keep going?",30, 390);
text("pull over?",640, 390);
textSize(20);
text("You are on your way to your mid day class,",190,490);
text("Its raining hard and you can hardly see in front of you,",190,510);
text("You hear a loud noise hit against your car.",190,530);
}
function secondScene() {
background(255);
image(keepGoing, 0, 0);
textSize(20);
text("You continue to drive..",190,490);
textSize(15);
text("click the car to continue",200, 510);
}
function thirdScene() {
background(255);
image(stopOnRoad, 0, 0);
textSize(20);
text("You pull your car over to the side to see what you have hit.",140,490);
textSize(16);
text("Click stop sign to continue",300, 510);
}
function fourthScene() {
background(255);
image(flash, 0, 0);
fill(255);
rect(25,350,80,80);
rect(625,350,80,80);
fill(0);
textSize(7);
text("Roll down your window?",30, 390);
textSize(10);
text("Speed off?",640, 390);
textSize(20);
text("Oh no! The police are behind you and the sirens are going off!",190,520);
}
function fifthScene() {
background(255);
image(rollDown, 0, 30);
fill(255);
rect(25,350,80,80);
fill(0);
textSize(9);
text("Talk to the police",30, 390);
textSize(18);
text("You pull over and roll down your window to talk to the cops",190, 490);
}
function sixthScene() {
background(255);
image(avoid, 0, 0);
fill(255);
rect(25,350,80,80);
fill(0);
textSize(8);
text("Click to continue",30, 390);
}
function seventhScene() {
background(255);
image(speedChase, 0, 0);
textSize(16);
text("The cops were actually chasing the car ahead of you. You chose to skip class and go home.",120,450);
}
function eighthScene() {
background(255);
image(gate, 0, 0);
fill(255);
rect(25,350,80,80);
fill(0);
textSize(9);
text("KEEP SPEEDING",30, 390);
}
function ninthScene() {
background(255);
textSize(35);
fill(0);
textFont('Arial');
text("You have been Arrested!", 60, 200);
}
function tenthScene() {
background(255);
image(hurtSquirrel, 0, 0);
fill(255);
rect(25,350,80,80);
rect(625,350,80,80);
fill(0);
textSize(8);
text("Take it in your car?",30, 390);
textSize(7);
text("Help it outside your car?",630, 390);
textSize(20);
text("You've hit a squirrel.",300,440);
}
function eleventhScene() {
background(255);
image(takeInCar, 0, 0);
textSize(14);
text("The squirrel gets scared and attacks you!",275,500);
textSize(10);
text("(Click the car to continue)",275,520);
}
function twelfthScene() {
background(255);
image(pickUp, 0, 0);
textSize(12);
text("The squirrel is scared when you pick it up but choses to allow you to help it.",170,450);
textSize(9);
text("(click the car to continue)",170,470);
}
function thirteenthScene() {
background(255);
textSize(35);
fill(0);
textFont('Arial');
text("You saved this Squirrel's life! Thank you!", 60, 200);
}
function fourteenthScene() {
background(255);
image(attack, 0, 0);
textSize(14);
text("(Click the car to continue)",275,520);
}
function fifteenthScene() {
background(255);
textSize(35);
fill(0);
textFont('Arial');
text("You got rabies! SEE A DOCTOR ASAP", 60, 300);
}
function mouseReleased() {
if (scene1 == true) {
if ((mouseY < 500) && (mouseY > 300) && (mouseX > 50) && (mouseX < 70)) {
scene1 = false;
scene2 = true;
}
else if ((mouseY < 440) && (mouseY > 300) && (mouseX > 640) && (mouseX < 700)) {
scene1 = false;
scene3 = true;
}
} else if (scene3 == true) {
if ((mouseY < 350) && (mouseY > 180) && (mouseX > 230) && (mouseX < 480)) {
scene3 = false;
scene10 = true;
}
} else if (scene10 == true) {
if ((mouseY < 400) && (mouseY > 340) && (mouseX > 20) && (mouseX < 110)) {
scene10 = false;
scene11 = true;
} else if ((mouseY < 430) && (mouseY > 340) && (mouseX > 620) && (mouseX < 710)) {
scene10 = false;
scene12 = true;
}
} else if (scene11 == true) {
if ((mouseY < 450) && (mouseY > 200) && (mouseX > 77) && (mouseX < 300)) {
scene11 = false;
scene14 = true;
}
} else if (scene12 == true) {
if ((mouseY < 380) && (mouseY > 270) && (mouseX > 2) && (mouseX < 340)) {
scene12 = false;
scene13 = true;
}
} else if (scene14 == true) {
if ((mouseY < 450) && (mouseY > 200) && (mouseX > 74) && (mouseX < 660)) {
scene14 = false;
scene15 = true;
}
} else if (scene2 == true) {
if ((mouseY < 450) && (mouseY > 350) && (mouseX > 370) && (mouseX < 690)) {
scene2 = false;
scene4 = true;
}
} else if (scene4 == true) {
if ((mouseY < 500) && (mouseY > 330) && (mouseX > 20) && (mouseX < 130)) {
scene4 = false;
scene5 = true;
} else if ((mouseY < 450) && (mouseY > 350) && (mouseX > 440) && (mouseX < 720)) {
scene4 = false;
scene6 = true;
}
} else if (scene5 == true) {
if ((mouseY < 440) && (mouseY > 340) && (mouseX > 20) && (mouseX < 130)) {
scene5 = false;
scene7 = true;
}
}
else if (scene6 == true) {
if ((mouseY < 430) && (mouseY > 350) && (mouseX > 20) && (mouseX < 100)) {
scene6 = false;
scene8 = true;
}
}
else if (scene8 == true) {
if ((mouseY < 430) && (mouseY > 350) && (mouseX > 20) && (mouseX < 100)) {
scene8 = false;
scene9 = true;
}
}
}