refactor(ball): Вычисление ертикальной и гроизонтальной скорости перенесено в класс Ball

This commit is contained in:
Ilia Mashkov
2026-07-19 13:15:50 +03:00
parent 0f057c1add
commit 62abd8b77d
2 changed files with 12 additions and 14 deletions
+1 -7
View File
@@ -30,13 +30,7 @@ export class Game {
this.maxLevel = levels.length - 1;
this.paddle = new Paddle(0, CONTAINER_HEIGHT - PADDLE_HEIGHT, PADDLE_WIDTH, PADDLE_HEIGHT);
this.ball = new Ball(
0,
0,
BALL_RADIUS,
BALL_SPEED * Math.cos(toRadians(BALL_INITIAL_ANGLE)),
-1 * BALL_SPEED * Math.sin(toRadians(BALL_INITIAL_ANGLE)),
);
this.ball = new Ball(0, 0, BALL_RADIUS, BALL_SPEED, BALL_INITIAL_ANGLE);
this.bricks = layBricks(this.levels[this.currentLevel], BRICK_WIDTH, BRICK_HEIGHT);
this._placeBallOnPaddle();