18 lines
419 B
Lua
18 lines
419 B
Lua
require "point"
|
|
require "config"
|
|
|
|
-- Point table with grid-based coordinates
|
|
GridPoint = Point:new()
|
|
|
|
-- Convert grid x, y to global x, y
|
|
function GridPoint:absolute()
|
|
return Point:new(
|
|
self.x * Config.cellSize,
|
|
self.y * Config.cellSize
|
|
)
|
|
end
|
|
|
|
-- Same as coords, but converted to global coords
|
|
function GridPoint:globalCoords()
|
|
return self.x * Config.cellSize, self.y * Config.cellSize
|
|
end
|