From 1c79bca1c90513a66cb2f9fcc1b4913de43441db Mon Sep 17 00:00:00 2001 From: HyperOnion <> Date: Sat, 24 Jun 2023 18:51:42 +0200 Subject: [PATCH] track nesting depth in boxes. --- js/world.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/world.mjs b/js/world.mjs index 36e714e..0ae1f14 100644 --- a/js/world.mjs +++ b/js/world.mjs @@ -8,6 +8,7 @@ export const CENTER = Math.floor(BOX_SIZE / 2); function create_world (size) { return { tiles: Array(size).fill(0).map(_ => Array(size).fill(0)), + depth: 0, }; } const world = create_world(BOX_SIZE); @@ -29,6 +30,7 @@ export function get_tile (world, x, y) { export function create_box (parent) { return { ...create_world(BOX_SIZE), + depth: parent.depth + 1, parent, }; }