Scale timer duration by equation difficulty
This commit is contained in:
parent
42e735569f
commit
b39dabfe9b
13
app.js
13
app.js
@ -687,9 +687,14 @@
|
|||||||
clearInterval(dementor.interval);
|
clearInterval(dementor.interval);
|
||||||
if (!resume) dementor.progress = 0;
|
if (!resume) dementor.progress = 0;
|
||||||
dementor.timedOut = false;
|
dementor.timedOut = false;
|
||||||
let speed = 250;
|
const difficulty = Math.max(game.currentFact.n1 || 1, game.currentFact.n2 || 1);
|
||||||
const step = 0.02;
|
let totalMs = 10000 + difficulty * 500; // base + more time for harder facts
|
||||||
if (game.timeTurnerCharges > 0) speed = 600;
|
let tickMs = 200;
|
||||||
|
if (game.timeTurnerCharges > 0) {
|
||||||
|
tickMs = 400;
|
||||||
|
totalMs *= 1.6;
|
||||||
|
}
|
||||||
|
const step = tickMs / totalMs;
|
||||||
|
|
||||||
updateDementorVisuals();
|
updateDementorVisuals();
|
||||||
dementor.interval = setInterval(() => {
|
dementor.interval = setInterval(() => {
|
||||||
@ -700,7 +705,7 @@
|
|||||||
dementor.timedOut = true;
|
dementor.timedOut = true;
|
||||||
handleDementorTimeout();
|
handleDementorTimeout();
|
||||||
}
|
}
|
||||||
}, speed);
|
}, tickMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDementorVisuals() {
|
function updateDementorVisuals() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user