Refactor/entities splitting #4

Merged
ilia merged 18 commits from refactor/entities-splitting into main 2026-07-18 08:02:47 +00:00
Showing only changes of commit 832e52c060 - Show all commits
+13 -4
View File
@@ -1,4 +1,4 @@
import { Graphics } from 'pixi.js';
import { Container, Graphics } from 'pixi.js';
import { Ball } from './entities/ball/ball';
import { Brick } from './entities/brick/brick';
import { Paddle } from './entities/paddle/paddle';
@@ -29,16 +29,25 @@ function createBrickView(brick) {
}
/**
* Создает визуальное отображение всех сущностей в игре с помощью Pixi.js
* Создает визуальное отображение всех сущностей в игре с помощью Pixi.js и добавляет в контейнер
* @param {Game} game экземпляр класса игра
* @param {Container} container контейнер Pixi.js
*/
export function createGameView(game) {
export function createGameView(game, container) {
try {
const ball = createBallView(game.ball);
container.addChild(ball);
const paddle = createPaddleView(game.paddle);
container.addChild(paddle);
const bricks = game.bricks.map((row) => row.map((brick) => createBrickView(brick)));
const bricks = game.bricks.map((row) =>
row.map((brick) => {
const brickView = createBrickView(brick);
container.addChild(brickView);
return brickView;
}),
);
return {
ball,