Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src/tick.c
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2025-04-06 09:15:32 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2025-04-06 09:15:32 +0100
commit8c4d5838e67d62775983fb46a64813d8b6bceb28 (patch)
treedbd84695d747253de214f57f882c8e9191158bbe /src/tick.c
parent1c7d286f89592f5ca89557565226869e7ec04bcb (diff)
downloadldjam57-8c4d5838e67d62775983fb46a64813d8b6bceb28.tar
Minor bug fixes
Diffstat (limited to 'src/tick.c')
-rw-r--r--src/tick.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/tick.c b/src/tick.c
index 4b255df..598087a 100644
--- a/src/tick.c
+++ b/src/tick.c
@@ -302,30 +302,39 @@ static void tick(Game *game, Arena a) {
}
break;
case EMPTY:
- // TODO: same as multiple reds
+ blues = 0;
if (
x > 0 &&
lastState->grid[x - 1 + y * GRIDWIDTH] == BLUE_RIGHT
) {
- game->state.grid[x + y * GRIDWIDTH] = BLUE_RIGHT;
+ blues++;
+ blue = BLUE_RIGHT;
}
if (
x < GRIDWIDTH - 1 &&
lastState->grid[x + 1 + y * GRIDWIDTH] == BLUE_LEFT
) {
- game->state.grid[x + y * GRIDWIDTH] = BLUE_LEFT;
+ blues++;
+ blue = BLUE_LEFT;
}
if (
y > 0 &&
lastState->grid[x + (y - 1) * GRIDWIDTH] == BLUE_DOWN
) {
- game->state.grid[x + y * GRIDWIDTH] = BLUE_DOWN;
+ blues++;
+ blue = BLUE_DOWN;
}
if (
y < GRIDHEIGHT - 1 &&
lastState->grid[x + (y + 1) * GRIDWIDTH] == BLUE_UP
) {
- game->state.grid[x + y * GRIDWIDTH] = BLUE_UP;
+ blues++;
+ blue = BLUE_UP;
+ }
+ if (blues == 1) {
+ game->state.grid[x + y * GRIDWIDTH] = blue;
+ } else if (blues >= 2) {
+ game->state.grid[x + y * GRIDWIDTH] = BLUE;
}
break;
}