diff options
author | Julien Dessaux | 2022-10-02 20:07:05 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-10-02 20:07:05 +0200 |
commit | d43dbfea61c230498023df8fe5350b67db746cdc (patch) | |
tree | c1cb66a517f37f08bdc3d8c1eae2187aab76ca03 | |
parent | Added end of round detection and scoring (diff) | |
download | grenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.tar.gz grenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.tar.bz2 grenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.zip |
Change who serves on each round
Diffstat (limited to '')
-rw-r--r-- | src/game.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game.zig b/src/game.zig index 9b8086d..ce98eef 100644 --- a/src/game.zig +++ b/src/game.zig @@ -33,7 +33,11 @@ pub const Game = struct { self.resetRound(); } pub fn resetRound(self: *Game) void { - self.ball.resetRound(.left); + if ((self.brothers[0].score + self.brothers[1].score) % 2 == 0) { + self.ball.resetRound(.left); + } else { + self.ball.resetRound(.right); + } self.brothers[0].resetRound(); self.brothers[1].resetRound(); } |