Skip to content

Commit 92176c6

Browse files
committed
Add collision with bombs
1 parent e296318 commit 92176c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/models/Game.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export class Game {
6060
const tile = this.map.getTile(playerPosition.x, playerPosition.y);
6161
if (!tile || tile.isObstacle) return;
6262

63+
const bomb = this.getBomb(playerPosition.x, playerPosition.y);
64+
if (bomb) return;
65+
6366
this.player.lastMove = Date.now();
6467
this.player.moveTo(playerPosition);
6568

@@ -77,8 +80,6 @@ export class Game {
7780
const bombIndex = this.bombs.findIndex(el => el.id === bomb.id);
7881
if (bombIndex === -1) return; // Already exploded
7982

80-
console.log('Exploding', bomb);
81-
8283
this.bombs.splice(bombIndex, 1);
8384
if (bomb.owner.id === this.player.id) this.player.bombsPlaced--;
8485

@@ -106,7 +107,6 @@ export class Game {
106107
}
107108

108109
for (const bomb of bombsToChain) {
109-
console.log('Chaining bomb', bomb);
110110
this.explode(bomb);
111111
}
112112
}

0 commit comments

Comments
 (0)