diff options
author | elioat <elioat@tilde.institute> | 2025-02-16 22:49:17 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2025-02-16 22:49:17 -0500 |
commit | 3077ce92405212f58fc5d2ef3b88575e4adb23d3 (patch) | |
tree | 558c2b0a835be2e61b03e3fd9c9529729fa3400c /html | |
parent | be8f389e4ceea897ebe63e31b84c73247adde387 (diff) | |
download | tour-3077ce92405212f58fc5d2ef3b88575e4adb23d3.tar.gz |
*
Diffstat (limited to 'html')
-rw-r--r-- | html/tower/js/game.js | 6 | ||||
-rw-r--r-- | html/tower/js/gameState.js | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/html/tower/js/game.js b/html/tower/js/game.js index 80b10d4..bcbbbb9 100644 --- a/html/tower/js/game.js +++ b/html/tower/js/game.js @@ -358,10 +358,10 @@ function startNextLevel() { generatePath(gameState.grid).then(path => { gameState.path = path; - // Increase number of enemies for each level + // Exponential enemy scaling const baseEnemies = 5; - const enemiesPerLevel = 3; - enemiesRemaining = baseEnemies + (gameState.level - 1) * enemiesPerLevel; + const scalingFactor = 1.5; // Each level increases by 50% + enemiesRemaining = Math.floor(baseEnemies * Math.pow(scalingFactor, gameState.level - 1)); // Re-enable tower palette document.querySelectorAll('.tower-option').forEach(option => { diff --git a/html/tower/js/gameState.js b/html/tower/js/gameState.js index d0ca661..861ecb3 100644 --- a/html/tower/js/gameState.js +++ b/html/tower/js/gameState.js @@ -117,9 +117,14 @@ function createEnemy(startPosition) { // 20% chance for ranged enemy const type = Math.random() < 0.2 ? 'RANGED' : 'BASIC'; const enemyType = EnemyTypes[type]; + + // Scale health ranges with level + const levelScaling = 1 + (gameState.level - 1) * 0.25; // increase health by 25% per level + const minHealth = Math.floor(enemyType.baseHealth.min * levelScaling); + const maxHealth = Math.floor(enemyType.baseHealth.max * levelScaling); + const health = Math.floor(Math.random() * - (enemyType.baseHealth.max - enemyType.baseHealth.min + 1)) + - enemyType.baseHealth.min; + (maxHealth - minHealth + 1)) + minHealth; return { position: { ...startPosition }, |