click to replay
This commit is contained in:
parent
3724fb1a4a
commit
a9ab775de7
@ -137,6 +137,14 @@ export class Game {
|
||||
let s = 'Score: $' + this.score
|
||||
ctx.fillText(t, ctx.oX + this.gw / 2 - ctx.measureText(t).width / 2, ctx.oY + this.gh / 2 - 15)
|
||||
ctx.fillText(s, ctx.oX + this.gw / 2 - ctx.measureText(s).width / 2, ctx.oY + this.gh / 2 + 15)
|
||||
if (ctx.mouse['btn0']) {
|
||||
setTimeout(() => {
|
||||
this.currentLevel = 0
|
||||
this.score = 0
|
||||
this.nextLevel()
|
||||
this.state = 0
|
||||
}, 500)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ const GameHeight = 720
|
||||
|
||||
let playing = true
|
||||
let player = new Player(GameWidth / 2 - 30, 25, GameHeight - 80)
|
||||
let game = new Game(60, player, player.h + 60, GameWidth, GameHeight)
|
||||
let game = new Game(10, player, player.h + 60, GameWidth, GameHeight)
|
||||
|
||||
// Retranslate score function
|
||||
player.score = function (obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user