track nesting depth in boxes.
This commit is contained in:
parent
5643fd86e2
commit
1c79bca1c9
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue