sketch
//A ghost is floating around, waiting to catch a unknowing passerby by surprise! Wait a bit and BOO!!!! The ghost has caught you ;)
var ghost1;
var ghost2;
var ghost3;
var ghost4;
var ghost5;
var ghost6;
var ghost7;
var ghost8;
var ghost9;
var ghost10;
var ghost11;
var ghost12;
var laughnoise;
var windsound;
function preload() {
ghost1 = loadImage('https://i.imgur.com/X4dZ0hI.jpg' );
ghost2 = loadImage('https://i.imgur.com/oEPEO2h.jpg' );
ghost3 = loadImage('https://i.imgur.com/YdezjuH.jpg' );
ghost4 = loadImage('https://i.imgur.com/ql1EG2S.jpg' );
ghost5 = loadImage('https://i.imgur.com/XwlxdCa.jpg' );
ghost6 = loadImage('https://i.imgur.com/fBUZvTM.jpg' );
ghost7 = loadImage('https://i.imgur.com/kdNl0ob.jpg');
ghost8 = loadImage('https://i.imgur.com/ZIooGoA.jpg' );
ghost9 = loadImage('https://i.imgur.com/c0UNjMv.jpg' );
ghost10 = loadImage('https://i.imgur.com/IucRj0z.jpg' );
ghost11 = loadImage('https://i.imgur.com/zmzgLi5.jpg' );
ghost12 = loadImage('https://i.imgur.com/ZeqmZnM.jpg' );
laughnoise = loadSound('https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/laughnoise-1.wav');
windsound = loadSound('https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/spookywind-1.wav');
}
function setup(){
createCanvas(600, 600);
frameRate(2);
useSound();
}
function soundSetup(){
laughnoise.setVolume(1);
windsound.setVolume(1);
}
function draw(){
background(0);
if(frameCount == 1){
image(ghost1,0,0);
windsound.play();
}
if(frameCount == 2){
image(ghost2,0,0);
}
if(frameCount == 3){
image(ghost3,0,0);
}
if(frameCount == 4){
image(ghost4,0,0);
}
if(frameCount == 5){
image(ghost5,0,0);
}
if(frameCount == 6){
image(ghost6,0,0);
}
if(frameCount == 7){
image(ghost7,0,0);
}
if(frameCount == 8){
image(ghost8,0,0);
}
if(frameCount == 9){
image(ghost9,0,0);
windsound.stop();
laughnoise.play();
}
if(frameCount == 10){
image(ghost10,0,0);
}
if(frameCount == 11){
image(ghos11,0,0);
}
if(frameCount >= 12){
image(ghost12,0,0);
}
}