make box checkerboard floors line up nicely.

This commit is contained in:
HyperOnion 2023-06-24 12:42:02 +02:00 committed by transoptimal
parent 9fd2b0e21b
commit 9668b8a8d2
1 changed files with 3 additions and 3 deletions

View File

@ -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);