Skip to content

Commit

Permalink
examples: fix (ball->side edge of brick) collision detection in break…
Browse files Browse the repository at this point in the history
…out.v
  • Loading branch information
spytheman committed Mar 8, 2025
1 parent 9ae8cc3 commit ef6b81d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/breakout/breakout.v
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fn (mut g Game) update() {
// Brick collisions
for mut brick in g.bricks {
if brick.alive && g.ball_y - g.ball_r < brick.y + brick.h && g.ball_y + g.ball_r > brick.y
&& g.ball_x > brick.x && g.ball_x < brick.x + brick.w {
&& g.ball_x + g.ball_r > brick.x && g.ball_x - g.ball_r < brick.x + brick.w {
g.play(.brick)
brick.alive = false
g.nbricks--
Expand Down

0 comments on commit ef6b81d

Please sign in to comment.