enemy bullet fix
This commit is contained in:
parent
88cf60e096
commit
e193c09280
14
Script.js
14
Script.js
@ -315,13 +315,13 @@ function drawGame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enemy shooting (aimed, non-homing)
|
// Enemy shooting (aimed, non-homing)
|
||||||
if (!player1.dead && Math.random() < 0.01) {
|
if (!player1.dead && Math.random() < 0.01 && s.x > player1.x + 50) {
|
||||||
const ex = s.x;
|
const ex = s.x;
|
||||||
const ey = s.y + s.height / 2;
|
const ey = s.y + s.height / 2;
|
||||||
const px = player1.x + player1.width / 2;
|
const px = player1.x + player1.width / 2;
|
||||||
const py = player1.y + player1.height / 2;
|
const py = player1.y + player1.height / 2;
|
||||||
enemyBulletsArray.push(new EnemyBullet(ex, ey, px, py));
|
enemyBulletsArray.push(new EnemyBullet(ex, ey, px, py));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collision with player (hitbox vs hitbox)
|
// Collision with player (hitbox vs hitbox)
|
||||||
if (!player1.dead && Tabrakan(player1.getHitbox(), s.getHitbox())) {
|
if (!player1.dead && Tabrakan(player1.getHitbox(), s.getHitbox())) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user