Skip to content

Commit

Permalink
feat(games): 방향벡터 x 성분의 크기에 따라 계수 가산 분기
Browse files Browse the repository at this point in the history
  • Loading branch information
nyj001012 committed Mar 13, 2024
1 parent b9e7099 commit 090352c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/pages/local-game/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,13 @@ export default function LocalGame($container, info = null) {
bounce(true, false);
hitCountOfWall = 0;
} else if (isBallHitWall(canvas, ball)) {
Math.abs(ball.direction.x) * 100 === 0
? hitCountOfWall++
: hitCountOfWall;
if (hitCountOfWall % 6 === 5) {
ball.direction.x *= getRandomCoefficient(2, 5);
Math.abs(ball.direction.x) <= 0.2 ? hitCountOfWall++ : hitCountOfWall;
if (hitCountOfWall % 5 === 4) {
Math.abs(ball.direction.x) <= 0.01
? (ball.direction.x *= getRandomCoefficient(60, 80))
: (ball.direction.x *= getRandomCoefficient(3, 4));
bounce(false, true);
hitCountOfWall = 0;
} else {
bounce(false, true);
}
Expand Down

0 comments on commit 090352c

Please sign in to comment.