xxxxxxxxxx
79
let x;
let y;
let introp;
let gameover;
let gamebool=false;
let introbool=true;
let gameoverbool=false;
let replaybool=false;
let B1;
let B2;
let B3;
let B4;
let B5;
let B6;
let B7;
let B8;
let IB;
let F1;
let GB;
function preload(){
B1=loadImage("B1.jpg");
B2=loadImage("B2.jpg");
B3=loadImage("B3.jpg");
B4=loadImage("B4.jpg");
B5=loadImage("B5.jpg");
B6=loadImage("B6.jpg");
B7=loadImage("B7.jpg");
B8=loadImage("B8.jpg");
IB=loadImage("IB.jpg");
F1=loadFont("Font1.ttf");
GB=loadImage("GB.jpg");
}
function setup() {
createCanvas(400, 500);
introp=new ipage(IB,F1);
gameover= new gameOver(GB);
}
function draw() {
if(introbool){
introp.getslider().show();
gamebool=introp.show();
if(gamebool){
introbool=false;
}
x= new dropBlocks(introp.getlvl());
y=new BS(x.getlvl(),B1,B2,B3,B4,B5,B6,B7,B8);
x.createBlock();
}
if(gamebool){
introp.getslider().hide();
fill(100);
y.showBG(x.getlvl());
circle(mouseX,mouseY,20);
gameoverbool=x.collision();
x.drop();
y.printlvl(x.getscore());
}
if(gameoverbool){
introp.getslider().hide()
gamebool=false;
gameover.show(x.score);
introbool=gameover.menubool;
replaybool=gameover.replaybool;
if(introbool){
gameoverbool=false;
introp.playbool=false;
}
if(replaybool){
gameoverbool=false;
x.recreate();
x.score=0;
gamebool=true;
introp.playbool=true;
}
}
}