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/tower/js/gameState.js | |
parent | be8f389e4ceea897ebe63e31b84c73247adde387 (diff) | |
download | tour-3077ce92405212f58fc5d2ef3b88575e4adb23d3.tar.gz |
*
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 }, |