feat: Добавлена функцияя для пересборки отображений кирпичей и удаления оставшихся отображений кирпичей из контейнера при смене уровня

This commit is contained in:
Ilia Mashkov
2026-07-19 10:53:40 +03:00
parent 5e259f7efc
commit 500803db84
2 changed files with 26 additions and 5 deletions
+6 -4
View File
@@ -17,7 +17,7 @@ import { LEVELS } from './const/levels';
import { Game } from './game';
import { calculateCollision } from './lib/calculateCollision/calculateCollision';
import { calculateDirection } from './lib/calculateDirection/calculateDirection';
import { createGameView, syncronizeViewsWithGame } from './view';
import { createGameView, rebuildBrickViews, syncronizeViewsWithGame } from './view';
(async () => {
// Create a new application
@@ -42,17 +42,19 @@ import { createGameView, syncronizeViewsWithGame } from './view';
const game = new Game(LEVELS);
const views = createGameView(game, container);
const currentLevel = game.currentLevel;
container.on('pointermove', (event) => {
const localPosition = container.toLocal(event.global);
game.paddle.moveTo(localPosition.x, 0, CONTAINER_WIDTH);
});
console.log(game.paddle.x, game.paddle.y);
app.ticker.add((time) => {
game.update(time.deltaTime);
if (game.currentLevel !== currentLevel) {
rebuildBrickViews(views, game, container);
}
syncronizeViewsWithGame(views, game);
console.log(game.paddle.x, game.paddle.y);
});
})();