feat(brick): Добавлены типы кирпичей: обычный, с 2 жизнями, неразрушаемый

This commit is contained in:
Ilia Mashkov
2026-07-19 10:51:58 +03:00
parent 111167b600
commit 5e259f7efc
5 changed files with 59 additions and 6 deletions
+10 -2
View File
@@ -63,9 +63,9 @@ export class Game {
return;
}
const isAnyBrickAlive = this.bricks.some((brick) => brick.alive);
const isLevelComplete = this._checkLevelCompletion();
if (!isAnyBrickAlive) {
if (isLevelComplete) {
this.currentLevel += 1;
if (this.currentLevel <= this.maxLevel) {
@@ -76,6 +76,14 @@ export class Game {
}
}
/**
* Проверяет завершен ли текущий уровень
* @returns {boolean}
*/
_checkLevelCompletion() {
return this.bricks.every((brick) => brick.type === 3 || !brick.alive);
}
/**
* Запускает переход на новый уровень, возвращает мяч в дефоотное положение и отрисовывает кирпичи по карте уровня.
*/