From e193c0928053466203dbdaff88cf023f290bb9c0 Mon Sep 17 00:00:00 2001 From: Bluwww Date: Sat, 13 Dec 2025 12:11:22 +0700 Subject: [PATCH] enemy bullet fix --- Script.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Script.js b/Script.js index 9581b00..182be80 100644 --- a/Script.js +++ b/Script.js @@ -315,13 +315,13 @@ function drawGame() { } // Enemy shooting (aimed, non-homing) - if (!player1.dead && Math.random() < 0.01) { - const ex = s.x; - const ey = s.y + s.height / 2; - const px = player1.x + player1.width / 2; - const py = player1.y + player1.height / 2; - enemyBulletsArray.push(new EnemyBullet(ex, ey, px, py)); - } + if (!player1.dead && Math.random() < 0.01 && s.x > player1.x + 50) { + const ex = s.x; + const ey = s.y + s.height / 2; + const px = player1.x + player1.width / 2; + const py = player1.y + player1.height / 2; + enemyBulletsArray.push(new EnemyBullet(ex, ey, px, py)); + } // Collision with player (hitbox vs hitbox) if (!player1.dead && Tabrakan(player1.getHitbox(), s.getHitbox())) {