Skip to content

Commit d3aa3ab

Browse files
committed
Made changes to avoid flickering
1 parent cedf49c commit d3aa3ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/bbreaker/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const BALL_RADIUS = 3;
33
const PADDLE_WIDTH = 26;
44
const PADDLE_HEIGHT = 6;
5-
const BRICK_ROWS = 4;
5+
const BRICK_ROWS = 2;
66
const BRICK_HEIGHT = 8;
77
const BRICK_PADDING = 4;
88
const BRICK_OFFSET_TOP = 40;
@@ -38,10 +38,12 @@
3838

3939
function initBricks() {
4040
bricks = []; // Reset the array completely
41+
let brickCount = 0;
4142
for (let r = 0; r < BRICK_ROWS; r++) {
4243
for (let c = 0; c < BRICK_COLS; c++) {
4344
let brickX = BRICK_OFFSET_LEFT + c * (BRICK_WIDTH + BRICK_PADDING);
4445
let brickY = BRICK_OFFSET_TOP + r * (BRICK_HEIGHT + BRICK_PADDING);
46+
if (brickCount++ > 20) return;
4547
bricks.push({ x: brickX, y: brickY, status: 1 });
4648
}
4749
}

0 commit comments

Comments
 (0)