From 818b90703a558dc2d7e2bb3d3e2e2f7ca7d341fb Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 27 Sep 2022 20:21:08 +0200 Subject: Display winning message --- src/game.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/game.zig') 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); -- cgit v1.2.3