diff --git a/sonic-radiance.love/scenes/battlesystem/utils.lua b/sonic-radiance.love/scenes/battlesystem/utils.lua index 97d82cb..5f2455a 100644 --- a/sonic-radiance.love/scenes/battlesystem/utils.lua +++ b/sonic-radiance.love/scenes/battlesystem/utils.lua @@ -67,6 +67,23 @@ function maputils.isInMask(x, y, ox, oy, shape, size, direction) end end +function maputils.maskToMap(ox, oy, shape, size, direction) + local map = maputils.newEmptyMap() + + for i, line in ipairs(map) do + for j, case in ipairs(line) do + local isInMask = maputils.isInMask(j, i, ox, oy, shape, size, direction) + if (isInMask) then + map[i][j] = 1 + else + map[i][j] = 0 + end + end + end + + return map +end + function maputils.gridToPixel(x, y, center) local pixelx, pixely local center = center or false