make box checkerboard floors line up nicely.
This commit is contained in:
parent
9fd2b0e21b
commit
9668b8a8d2
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue