===================================================================
--- original.js
+++ change.js
@@ -97,8 +97,18 @@
// Handle player and enemy collision
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
+ for (var l = bullets.length - 1; l >= 0; l--) {
+ if (bullets[l].intersects(enemies[k])) {
+ // Handle bullet and enemy collision
+ enemies[k].destroy();
+ enemies.splice(k, 1);
+ bullets[l].destroy();
+ bullets.splice(l, 1);
+ break;
+ }
+ }
}
};
// Handle player shooting
game.down = function (x, y, obj) {
Player man. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Enemy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Battle ground. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.