mirror of
https://github.com/danbulant/bobek
synced 2026-06-24 17:11:57 +00:00
localStorage fixed for online
This commit is contained in:
parent
b6b38293b3
commit
bea2628ed9
1 changed files with 15 additions and 8 deletions
23
game.js
23
game.js
|
|
@ -239,16 +239,23 @@
|
||||||
sctx.strokeText(this.score.curr,scrn.width/2,50);
|
sctx.strokeText(this.score.curr,scrn.width/2,50);
|
||||||
break;
|
break;
|
||||||
case state.gameOver :
|
case state.gameOver :
|
||||||
this.score.best = Math.max(this.score.curr,localStorage.getItem("best"));
|
|
||||||
localStorage.setItem("best",this.score.best);
|
|
||||||
sctx.lineWidth = "2";
|
sctx.lineWidth = "2";
|
||||||
sctx.font = "40px Squada One";
|
sctx.font = "40px Squada One";
|
||||||
let sc = `SCORE : ${this.score.curr}`
|
let sc = `SCORE : ${this.score.curr}`;
|
||||||
let bs = `BEST : ${this.score.best}`
|
try {
|
||||||
sctx.fillText(sc,scrn.width/2-80,scrn.height/2);
|
this.score.best = Math.max(this.score.curr,localStorage.getItem("best"));
|
||||||
sctx.strokeText(sc,scrn.width/2-80,scrn.height/2);
|
localStorage.setItem("best",this.score.best);
|
||||||
sctx.fillText(bs,scrn.width/2-80,scrn.height/2+30);
|
let bs = `BEST : ${this.score.best}`;
|
||||||
sctx.strokeText(bs,scrn.width/2-80,scrn.height/2+30);
|
sctx.fillText(sc,scrn.width/2-80,scrn.height/2);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
sctx.fillText(sc,scrn.width/2-85,scrn.height/2+15);
|
||||||
|
sctx.strokeText(sc,scrn.width/2-85,scrn.height/2+15);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue