refactor(tick): В условия добавлены return для отсеивания лишних операций
This commit is contained in:
@@ -50,7 +50,7 @@ describe('tick', () => {
|
||||
const game = new Game(1, 1);
|
||||
const brick = game.bricks[0][0];
|
||||
|
||||
game.ball.x = brick.x + 1;
|
||||
game.ball.x = brick.x + game.ball.radius + 1;
|
||||
game.ball.y = brick.y + brick.height + game.ball.radius + 1;
|
||||
game.ball.horizontalSpeed = 0;
|
||||
game.ball.verticalSpeed = -10;
|
||||
@@ -65,7 +65,7 @@ describe('tick', () => {
|
||||
const game = new Game(2, 1);
|
||||
const [firstBrick, secondBrick] = game.bricks[0];
|
||||
|
||||
game.ball.x = firstBrick.x + 1;
|
||||
game.ball.x = firstBrick.x + game.ball.radius + 1;
|
||||
game.ball.y = firstBrick.y + firstBrick.height + game.ball.radius + 1;
|
||||
game.ball.horizontalSpeed = 0;
|
||||
game.ball.verticalSpeed = -10;
|
||||
|
||||
Reference in New Issue
Block a user