Skip to content

Commit

Permalink
fix collision bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wpowers42 committed Sep 15, 2023
1 parent 007d5fa commit 465864f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion games/breakout/src/Ball.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion games/breakout/src/states/PlayState.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion games/breakout/src/states/PlayState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class PlayState extends BaseState {
for (const brick of this.bricks) {
brick.update(dt);

if (brick.inPlay && this.ball.collides(brick) && this.score) {
if (brick.inPlay && this.ball.collides(brick) && this.score !== undefined) {
this.score += brick.tier * 200 + brick.color * 25;

brick.hit();
Expand Down

0 comments on commit 465864f

Please sign in to comment.