diff options
Diffstat (limited to 'html/tower/js/gameState.js')
-rw-r--r-- | html/tower/js/gameState.js | 9 |
1 files changed, 7 insertions, 2 deletions
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 }, |