2017-09-28 12:20:20 +02:00
|
|
|
--Pacman void script by TWLTriston
|
|
|
|
|
|
|
|
local grid_width = 40
|
|
|
|
local grid_height = 40
|
|
|
|
local grid_scale = 32 -- 4/8/16/32 are good values here
|
|
|
|
|
2019-02-01 03:15:41 +02:00
|
|
|
local starting_grid = require "map_gen.maps.pacman_grids.classic"
|
|
|
|
--local starting_grid = require "map_gen.maps.pacman_grids.rotated_rectangles"
|
2017-09-28 12:20:20 +02:00
|
|
|
|
2018-05-10 21:42:24 +02:00
|
|
|
local image_grid = starting_grid.image_grid
|
|
|
|
local mult = 1 / grid_scale
|
2017-09-28 12:20:20 +02:00
|
|
|
|
2018-05-10 21:42:24 +02:00
|
|
|
return function(x, y)
|
2018-11-21 15:42:39 +02:00
|
|
|
x = x * mult - 20
|
|
|
|
y = y * mult - 21
|
|
|
|
x = math.floor(x) % grid_width + 1
|
|
|
|
y = math.floor(y) % grid_height + 1
|
2017-09-28 12:20:20 +02:00
|
|
|
|
2018-11-21 15:42:39 +02:00
|
|
|
local pixel = image_grid[y][x]
|
|
|
|
return pixel == 1
|
2017-09-28 12:20:20 +02:00
|
|
|
end
|