feat(brick): Добавлены типы кирпичей: обычный, с 2 жизнями, неразрушаемый
This commit is contained in:
+10
-2
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Запускает переход на новый уровень, возвращает мяч в дефоотное положение и отрисовывает кирпичи по карте уровня.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user