balance difficulty tuning for spawn pace and damage windows

This commit is contained in:
OpenClaw Engineer 2026-03-04 07:03:53 -06:00
parent a848a6854b
commit be519d515e

View File

@ -22,9 +22,33 @@ const groundY = 420;
const worldWidth = 13000; const worldWidth = 13000;
const DIFFICULTY = { const DIFFICULTY = {
easy: { moveSpeed: 0.9, hazardSpeed: 0.85, pteroSpawn: 2.6, meteorSpawn: 1.9 }, easy: {
medium: { moveSpeed: 1.0, hazardSpeed: 1.0, pteroSpawn: 2.2, meteorSpawn: 1.5 }, moveSpeed: 0.88,
hard: { moveSpeed: 1.15, hazardSpeed: 1.25, pteroSpawn: 1.7, meteorSpawn: 1.2 } hazardSpeed: 0.75,
pteroSpawn: 3.0,
meteorSpawn: 2.25,
hitCooldown: 1.35,
pteroUnlock: 140,
meteorUnlock: 340
},
medium: {
moveSpeed: 1.0,
hazardSpeed: 1.0,
pteroSpawn: 2.2,
meteorSpawn: 1.5,
hitCooldown: 1.0,
pteroUnlock: 100,
meteorUnlock: 250
},
hard: {
moveSpeed: 1.18,
hazardSpeed: 1.35,
pteroSpawn: 1.45,
meteorSpawn: 1.05,
hitCooldown: 0.7,
pteroUnlock: 70,
meteorUnlock: 170
}
}; };
const BIOMES = [ const BIOMES = [
@ -427,7 +451,7 @@ async function kill(reason) {
function applyHit(reason) { function applyHit(reason) {
if (state.hitCooldown > 0 || state.dead) return; if (state.hitCooldown > 0 || state.dead) return;
state.hearts -= 1; state.hearts -= 1;
state.hitCooldown = 1; state.hitCooldown = DIFFICULTY[gameConfig.difficulty].hitCooldown;
playSfx('hit'); playSfx('hit');
if (state.hearts <= 0) kill(reason); if (state.hearts <= 0) kill(reason);
} }
@ -531,7 +555,7 @@ function getPlayerHitboxForAirHazards(player) {
} }
function updatePterodactyls(dt) { function updatePterodactyls(dt) {
if (state.score <= 100) return; if (state.score <= DIFFICULTY[gameConfig.difficulty].pteroUnlock) return;
state.pteroSpawnTimer -= dt; state.pteroSpawnTimer -= dt;
if (state.pteroSpawnTimer <= 0) { if (state.pteroSpawnTimer <= 0) {
@ -552,7 +576,7 @@ function updatePterodactyls(dt) {
} }
function updateMeteors(dt) { function updateMeteors(dt) {
if (state.score <= 250) return; if (state.score <= DIFFICULTY[gameConfig.difficulty].meteorUnlock) return;
state.meteorSpawnTimer -= dt; state.meteorSpawnTimer -= dt;
if (state.meteorSpawnTimer <= 0) { if (state.meteorSpawnTimer <= 0) {