mirror of
https://github.com/danbulant/bobek
synced 2026-07-05 19:10:51 +00:00
UI curr fixed
This commit is contained in:
parent
5744ccf530
commit
a07681c3b5
1 changed files with 7 additions and 6 deletions
13
game.js
13
game.js
|
|
@ -216,23 +216,24 @@
|
||||||
curr : 0,
|
curr : 0,
|
||||||
best : 0,
|
best : 0,
|
||||||
},
|
},
|
||||||
|
curr : undefined,
|
||||||
frame : 0,
|
frame : 0,
|
||||||
draw : function() {
|
draw : function() {
|
||||||
switch (state.curr) {
|
switch (state.curr) {
|
||||||
case state.getReady :
|
case state.getReady :
|
||||||
curr = this.getReady;
|
this.curr = this.getReady;
|
||||||
break;
|
break;
|
||||||
case state.gameOver :
|
case state.gameOver :
|
||||||
curr = this.gameOver;
|
this.curr = this.gameOver;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let y = parseFloat(scrn.height-curr.sprite.height)/2;
|
let y = parseFloat(scrn.height-this.curr.sprite.height)/2;
|
||||||
let x = parseFloat(scrn.width-curr.sprite.width)/2;
|
let x = parseFloat(scrn.width-this.curr.sprite.width)/2;
|
||||||
if(state.curr!=state.Play)
|
if(state.curr!=state.Play)
|
||||||
{
|
{
|
||||||
let tx = parseFloat(scrn.width - this.tap[0].sprite.width)/2;
|
let tx = parseFloat(scrn.width - this.tap[0].sprite.width)/2;
|
||||||
let ty = y + curr.sprite.height- this.tap[0].sprite.height;
|
let ty = y + this.curr.sprite.height- this.tap[0].sprite.height;
|
||||||
sctx.drawImage(curr.sprite,x,y);
|
sctx.drawImage(this.curr.sprite,x,y);
|
||||||
sctx.drawImage(this.tap[this.frame].sprite,tx,ty)
|
sctx.drawImage(this.tap[this.frame].sprite,tx,ty)
|
||||||
}
|
}
|
||||||
this.drawScore();
|
this.drawScore();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue