This commit is contained in:
Abdelrahman Tarek 2019-10-23 02:15:28 +02:00
parent 9ec86ee63e
commit cc69f30ba3
2 changed files with 12 additions and 8 deletions

19
game.js
View file

@ -257,16 +257,18 @@
drawScore : function() {
sctx.fillStyle = "#FFFFFF";
sctx.strokeStyle = "#000000";
switch (state.curr) {
case state.Play :
if(state.curr == state.Play )
{
sctx.lineWidth = "2";
sctx.font = "35px Squada One";
sctx.fillText(this.score.curr,scrn.width/2,50);
sctx.strokeText(this.score.curr,scrn.width/2,50);
break;
case state.gameOver :
this.score.best = Math.max(this.score.curr,localStorage.getItem("best"));
localStorage.setItem("best",this.score.best);
}
if(state.curr == state.gameOver )
{
//this.score.best = Math.max(this.score.curr,localStorage.getItem("best"));
//localStorage.setItem("best",this.score.best);
sctx.lineWidth = "2";
sctx.font = "40px Squada One";
let sc = `SCORE : ${this.score.curr}`
@ -275,8 +277,9 @@
sctx.strokeText(sc,scrn.width/2-80,scrn.height/2);
sctx.fillText(bs,scrn.width/2-80,scrn.height/2+30);
sctx.strokeText(bs,scrn.width/2-80,scrn.height/2+30);
break;
}
}
}
};

View file

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">