Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,17 @@ class Game {
bullet.flagForDeletion();
player.loseHealth(); // Damage Player
}

//create health bar instance and if health bar percent is zero then lose health
});

// Check Boss is hit by Player Bullets
let bossPositionAndSize = self.collisionChecker.formatPlayerPositionAndSize(boss);
//boss-player check collision
// Check Boss is hit by Player Bullets
if(self.collisionChecker.checkForCollision(playerPositionAndSize, bossPositionAndSize)){
player.loseHealth();
player.vulnerableTimeLeft = player.hitVulnerabilityTime;
}

player.bullets.forEach((bullet) => {
let bulletPositionAndSize = self.collisionChecker.formatBulletPositionAndSize(bullet);
if (self.collisionChecker.checkForCollision(bulletPositionAndSize, bossPositionAndSize)) {
Expand Down