refactor(ball): Вычисление ертикальной и гроизонтальной скорости перенесено в класс Ball
This commit is contained in:
+1
-7
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user