From 6df46c628e8370cbc966aefd21cba57f5caa8131 Mon Sep 17 00:00:00 2001 From: Darkin Date: Sun, 20 Oct 2019 20:13:58 +0200 Subject: [PATCH] UI.curr removed for github pages --- game.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/game.js b/game.js index fbb7c67..87c00ff 100644 --- a/game.js +++ b/game.js @@ -216,26 +216,30 @@ curr : 0, best : 0, }, - curr : undefined, + x :0, + y :0, + tx :0, + ty :0, frame : 0, draw : function() { switch (state.curr) { case state.getReady : - this.curr = this.getReady; + this.y = parseFloat(scrn.height-this.getReady.sprite.height)/2; + this.x = parseFloat(scrn.width-this.getReady.sprite.width)/2; + this.tx = parseFloat(scrn.width - this.tap[0].sprite.width)/2; + this.ty = this.y + this.getReady.sprite.height- this.tap[0].sprite.height; + sctx.drawImage(this.getReady.sprite,this.x,this.y); + sctx.drawImage(this.tap[this.frame].sprite,this.tx,this.ty) break; case state.gameOver : - this.curr = this.gameOver; + this.y = parseFloat(scrn.height-this.gameOver.sprite.height)/2; + this.x = parseFloat(scrn.width-this.gameOver.sprite.width)/2; + this.tx = parseFloat(scrn.width - this.tap[0].sprite.width)/2; + this.ty = this.y + this.gameOver.sprite.height- this.tap[0].sprite.height; + sctx.drawImage(this.gameOver.sprite,this.x,this.y); + sctx.drawImage(this.tap[this.frame].sprite,this.tx,this.ty) break; } - 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 + 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(); }, drawScore : function() {