aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2022-09-27 20:21:08 +0200
committerJulien Dessaux2022-09-27 20:21:08 +0200
commit818b90703a558dc2d7e2bb3d3e2e2f7ca7d341fb (patch)
treeb45dc25e7597f8e11f0f7a0e130fcc0b927081c5
parentDisplay scores (diff)
downloadgrenade-brothers-818b90703a558dc2d7e2bb3d3e2e2f7ca7d341fb.tar.gz
grenade-brothers-818b90703a558dc2d7e2bb3d3e2e2f7ca7d341fb.tar.bz2
grenade-brothers-818b90703a558dc2d7e2bb3d3e2e2f7ca7d341fb.zip
Display winning message
-rw-r--r--src/game.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game.zig b/src/game.zig
index d0395a0..9597a83 100644
--- a/src/game.zig
+++ b/src/game.zig
@@ -18,6 +18,14 @@ pub const Game = struct {
// draw the net
w4.DRAW_COLORS.* = 0x42;
w4.rect(78, 100, 4, 61);
+ // Did someone win?
+ if (self.ball.y >= 160 - ball.ball_height) {
+ if (self.ball.x >= 80) {
+ w4.text("Scored!", 8, 64);
+ } else {
+ w4.text("Scored!", 160 - 56 - 8, 64);
+ }
+ }
}
pub fn reset(self: *Game) void {
self.brothers[0].reset(.left);