added sys digger
This commit is contained in:
@@ -79,6 +79,7 @@ function topScore() {
|
||||
let score = 0;
|
||||
let docks = 0;
|
||||
let gameOver = false;
|
||||
let gameStarted = false;
|
||||
let incomingAtoms = [];
|
||||
let anchorPoints = [];
|
||||
let particles = [];
|
||||
@@ -177,19 +178,26 @@ function submitScore() {
|
||||
function restartGame() {
|
||||
score = docks = 0;
|
||||
gameOver = false;
|
||||
gameStarted = false;
|
||||
incomingAtoms = [];
|
||||
particles = [];
|
||||
clickEffects = [];
|
||||
lastSpawn = 0;
|
||||
spawnInterval = SPAWN_INTERVAL_START;
|
||||
document.getElementById('score').textContent = 'Score: 0';
|
||||
document.getElementById('docks-count').textContent = '0 / 8 docks';
|
||||
document.getElementById('docks-count').textContent = `0 / ${MAX_DOCKS} docks`;
|
||||
document.getElementById('name-form').style.display = 'flex';
|
||||
document.getElementById('overlay').classList.remove('active');
|
||||
document.getElementById('intro').classList.remove('hidden');
|
||||
initAnchors();
|
||||
updateCystinstein();
|
||||
}
|
||||
|
||||
function startGame() {
|
||||
gameStarted = true;
|
||||
document.getElementById('intro').classList.add('hidden');
|
||||
}
|
||||
|
||||
function updateHudBest(best) {
|
||||
document.getElementById('highscore').textContent = best !== null ? `Best: ${best}` : 'Best: —';
|
||||
}
|
||||
@@ -203,7 +211,7 @@ document.getElementById('player-name').addEventListener('keydown', e => {
|
||||
function gameLoop(ts) {
|
||||
drawBackground();
|
||||
|
||||
if (!gameOver && ts - lastSpawn > spawnInterval) {
|
||||
if (gameStarted && !gameOver && ts - lastSpawn > spawnInterval) {
|
||||
spawnAtom();
|
||||
lastSpawn = ts;
|
||||
spawnInterval = Math.max(SPAWN_INTERVAL_MIN, spawnInterval - SPAWN_DIFFICULTY_STEP);
|
||||
@@ -221,6 +229,9 @@ function gameLoop(ts) {
|
||||
}
|
||||
|
||||
// ─── Boot ────────────────────────────────────────────────────────────────────
|
||||
// Fill dynamic value in intro text
|
||||
document.getElementById('intro').innerHTML =
|
||||
document.getElementById('intro').innerHTML.replace('${MAX_DOCKS}', MAX_DOCKS);
|
||||
updateHudBest(topScore());
|
||||
initAnchors();
|
||||
updateCystinstein();
|
||||
|
||||
Reference in New Issue
Block a user