From 9668b8a8d2a7fb38430013fee0023b6fbb06d946 Mon Sep 17 00:00:00 2001 From: HyperOnion <> Date: Sat, 24 Jun 2023 12:42:02 +0200 Subject: [PATCH] make box checkerboard floors line up nicely. --- js/graphics.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/graphics.mjs b/js/graphics.mjs index d7e68f8..7406eee 100644 --- a/js/graphics.mjs +++ b/js/graphics.mjs @@ -21,9 +21,9 @@ function checkerboard (x, y) { return ((x ^ y) & 1) === 0; } -export function draw_floor (start_x, start_y, scale) { +export function draw_floor (start_x, start_y, scale, invert = false) { iter_2d(range(0, world.BOX_SIZE - 1), (x, y) => { - if (checkerboard(x, y)) { + if (checkerboard(x, y) !== invert) { graphics.set_color("#aaa"); } else { graphics.set_color("#888"); @@ -34,7 +34,7 @@ export function draw_floor (start_x, start_y, scale) { } export function draw_world (box, start_x = 0, start_y = 0, scale = BASE_SCALE) { - draw_floor(start_x, start_y, scale); + draw_floor(start_x, start_y, scale, !checkerboard(start_x, start_y)); iter_2d(range(0, world.BOX_SIZE - 1), (x, y) => { const tile = world.get_tile(box, x, y);