clean up world constants to make more sense.

create a constant that represents the amount of tiles a box extends out
from its center in all 4 directions. compute the box size and box center
position constants from this new constant, instead of having them be
hard-coded.
This commit is contained in:
HyperOnion 2023-06-28 16:16:26 +02:00
parent 9193a43fbc
commit 171d78adb0
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,8 @@
import { iter_2d, range } from "./utils/range.mjs";
export const BOX_SIZE = 9;
export const CENTER = Math.floor(BOX_SIZE / 2);
const BOX_EXTENT_FROM_CENTER = 4;
export const BOX_SIZE = BOX_EXTENT_FROM_CENTER * 2 + 1;
export const CENTER = BOX_EXTENT_FROM_CENTER;