From a07681c3b54033d196b3d7c65aecc4ef8f7210c9 Mon Sep 17 00:00:00 2001 From: Darkin Date: Sun, 20 Oct 2019 19:56:53 +0200 Subject: [PATCH] UI curr fixed --- game.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/game.js b/game.js index ff133c6..fbb7c67 100644 --- a/game.js +++ b/game.js @@ -216,23 +216,24 @@ curr : 0, best : 0, }, + curr : undefined, frame : 0, draw : function() { switch (state.curr) { case state.getReady : - curr = this.getReady; + this.curr = this.getReady; break; case state.gameOver : - curr = this.gameOver; + this.curr = this.gameOver; break; } - let y = parseFloat(scrn.height-curr.sprite.height)/2; - let x = parseFloat(scrn.width-curr.sprite.width)/2; + let y = parseFloat(scrn.height-this.curr.sprite.height)/2; + let x = parseFloat(scrn.width-this.curr.sprite.width)/2; if(state.curr!=state.Play) { let tx = parseFloat(scrn.width - this.tap[0].sprite.width)/2; - let ty = y + curr.sprite.height- this.tap[0].sprite.height; - sctx.drawImage(curr.sprite,x,y); + let ty = y + this.curr.sprite.height- this.tap[0].sprite.height; + sctx.drawImage(this.curr.sprite,x,y); sctx.drawImage(this.tap[this.frame].sprite,tx,ty) } this.drawScore();