xxxxxxxxxx
36
function Endscreen() {
let restart = 0;
}
Endscreen.prototype.show = function() {
//flappy bird title at top
stroke(0);
strokeWeight(4);
background(255, 0, 0);
fill(255, 255);
strokeWeight(2);
rect(1/4*width, 2/3*height, 2/4*width, 1/6*height);
textSize(128);
text("You Lose!", 60, 170);
stroke(255);
strokeWeight(15);
line(60, 190, 600, 190);
strokeWeight(1);
stroke(0);
textSize(50);
fill(0);
textAlign(CENTER);
text("Play Again!", width/2, 24/30*height);
textAlign(LEFT);
}
Endscreen.prototype.update = function() {
if (this.restart === 1 && mouseX > 1/3*width && mouseX < 2/3*width && mouseY>2/3*height && mouseY<5/6*height) {
for (let i = pipes.length - 1; i >= 0; i--) {
pipes.splice(i, i+1);
}
score = 0;
bird.y = height/2;
screen = 1;
}
}