Commit a9ab775d authored by Evert Prants's avatar Evert Prants

click to replay

parent 3724fb1a
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment