const lives = new Indicator({num:3, fill:true, foregroundColor:red, backgroundColor:faint}).pos(250,100);
const scorer = new Scorer({backgroundColor:"blue", color:"white", isometric:"right"}).pos(30,35,true).sha(shadow);
lives.selectedIndex = 2;
Ticker.add(() => {
drop.loop(circle => {
if (paddle.hitTestCircle(circle)) {
if (circle.color == red) {
lives.selectedIndex = lives.selectedIndex - 1;
if (lives.selectedIndex < 0) paneGameover.show() // zgo("");
} else {
scorer.score = scorer.score + 1;
}
circle.removeFrom();
}
}, true); // loop backwards when removing objects
});
function gameOver() {
Ticker.removeFrom();
circle.alp(0);
pane.show(); // make the Pane() below as well
}
// part of STEP 12
var paneGameover = new Pane({
label:"GAME OVER",
backgroundColor:yellow,
close:true,
displayClose:false,
backdropClose:false,
width:600,
height:200,
corner:0
});
asset("space08").pos(200,0,CENTER,CENTER, paneGameover);
paneGameover.on("close", restart);
function restart() {
scorer.score=0;
lives.selectedIndex=3
};
}
stage.update(); // this is needed to show any changes
}); // end of ready