about summary refs log tree commit diff stats
path: root/html/plains/game.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/plains/game.js')
-rw-r--r--html/plains/game.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/html/plains/game.js b/html/plains/game.js
index 12742d4..deaebad 100644
--- a/html/plains/game.js
+++ b/html/plains/game.js
@@ -749,8 +749,8 @@ const createBubbleAttack = (state, animationTime) => {
     };
 };
 
-// Add this helper function near other weapon-related functions
-const checkEnemyCollision = (enemy, sourceX, sourceY, range) => {
+// Update the collision helper to handle different damage amounts
+const checkEnemyCollision = (enemy, sourceX, sourceY, range, damage = 0) => {
     if (enemy.stunned) return false;
     
     const dx = enemy.x - sourceX;
@@ -759,7 +759,7 @@ const checkEnemyCollision = (enemy, sourceX, sourceY, range) => {
     
     if (distance < enemy.size + range) {
         const knockbackAngle = Math.atan2(dy, dx);
-        enemySystem.handleEnemyDamage(enemy, 1, 1, knockbackAngle);
+        enemySystem.handleEnemyDamage(enemy, damage, 1, knockbackAngle);
         return true;
     }
     return false;
@@ -770,9 +770,9 @@ const weaponSystems = {
         const updatedBubbles = state.player.bubbles
             .filter(bubble => animationTime - bubble.createdAt < CONFIG.bubble.lifetime)
             .map(bubble => {
-                // Check for enemy collisions
+                // Check for enemy collisions with 0 damage
                 state.enemies.forEach(enemy => {
-                    checkEnemyCollision(enemy, bubble.x, bubble.y, CONFIG.bubble.size);
+                    checkEnemyCollision(enemy, bubble.x, bubble.y, CONFIG.bubble.size, 0);
                 });
                 return updateBubble(bubble, animationTime);
             });
@@ -799,9 +799,9 @@ const weaponSystems = {
         const newAngle = state.player.swordAngle + CONFIG.sword.swingSpeed;
         const swingComplete = newAngle > Math.atan2(state.player.direction.y, state.player.direction.x) + Math.PI / 2;
         
-        // Check all enemies for sword collision
+        // Check all enemies for sword collision with 1 damage
         const updatedEnemies = state.enemies.map(enemy => {
-            checkEnemyCollision(enemy, state.player.x, state.player.y, CONFIG.sword.length);
+            checkEnemyCollision(enemy, state.player.x, state.player.y, CONFIG.sword.length, 1);
             return enemy;
         });