aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulien Dessaux2022-10-02 20:07:05 +0200
committerJulien Dessaux2022-10-02 20:07:05 +0200
commitd43dbfea61c230498023df8fe5350b67db746cdc (patch)
treec1cb66a517f37f08bdc3d8c1eae2187aab76ca03 /src
parentAdded end of round detection and scoring (diff)
downloadgrenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.tar.gz
grenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.tar.bz2
grenade-brothers-d43dbfea61c230498023df8fe5350b67db746cdc.zip
Change who serves on each round
Diffstat (limited to 'src')
-rw-r--r--src/game.zig6
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();
}