diff options
Diffstat (limited to 'html/tower')
-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 }, |