This commit is contained in:
2023-06-26 01:29:49 +02:00
parent b0775a8d1f
commit 2904062dfe
3 changed files with 54 additions and 1 deletions

20
app.js
View File

@@ -592,6 +592,7 @@ class Stats {
if (score > this.highScore) {
this.highScore = score
}
scoreDiv.innerText = score.toLocaleString()
}
get score() {
@@ -608,12 +609,22 @@ class Stats {
this.lockDelay = 500 * Math.pow(0.9, level - 15)
levelInput.value = level
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>NIVEAU<br/>${this.level}</h1>` })
levelDiv.innerText = level
}
get level() {
return this._level
}
set goal(goal) {
this._goal = goal
goalDiv.innerText = goal
}
get goal() {
return this._goal
}
set combo(combo) {
this._combo = combo
if (combo > this.maxCombo) this.maxCombo = combo
@@ -750,6 +761,10 @@ Stats.prototype.timeFormat = new Intl.DateTimeFormat("fr-FR", {
timeZone: "UTC"
})
function tick() {
timeDiv.innerText = stats.timeFormat.format(stats.time)
}
/* Scene */
@@ -983,6 +998,7 @@ function pauseSettings() {
scheduler.clearTimeout(lockDown)
scheduler.clearTimeout(repeat)
scheduler.clearInterval(autorepeat)
scheduler.clearInterval(tick)
music.pause()
document.onkeydown = null
@@ -1036,6 +1052,8 @@ function resume(event) {
music.play()
}
scheduler.setInterval(tick)
if (piece) scheduler.setInterval(fall, stats.fallPeriod)
else generate()
}
@@ -1199,6 +1217,8 @@ function gameOver() {
playing = false
music.pause()
scheduler.clearInterval(tick)
stats.show()
}