Initial commit
This commit is contained in:
commit
f765ec74ef
6 changed files with 181 additions and 0 deletions
18
gridpoint.lua
Normal file
18
gridpoint.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue