From 171d78adb0734ed0685eb325bc9d13b5b81ceef6 Mon Sep 17 00:00:00 2001 From: HyperOnion <> Date: Wed, 28 Jun 2023 16:16:26 +0200 Subject: [PATCH] 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. --- js/world.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/world.mjs b/js/world.mjs index 0c6a1dc..9d0c719 100644 --- a/js/world.mjs +++ b/js/world.mjs @@ -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;