Made collision objects more consistent
This commit is contained in:
@@ -47,15 +47,10 @@ local function initMaze(world, mazeWidth, mazeHeight)
|
||||
|
||||
for _, exitTile in ipairs(exitTiles) do
|
||||
local exitX, exitY = mazeutils.tileToWorld(exitTile.x, exitTile.y)
|
||||
local exit = { x = exitX, y = exitY, isExit = true }
|
||||
local exit = { pos = { x = exitX, y = exitY }, size = { w = TILE_SIZE, h = TILE_SIZE }, isExit = true }
|
||||
grid[exitTile.y][exitTile.x] = Tile.exit
|
||||
table.insert(exits, exit)
|
||||
world:add(
|
||||
exit,
|
||||
exit.x, exit.y,
|
||||
TILE_SIZE,
|
||||
TILE_SIZE
|
||||
)
|
||||
world:add(exit, exit.pos.x, exit.pos.y, exit.size.w, exit.size.h)
|
||||
end
|
||||
|
||||
|
||||
@@ -149,7 +144,7 @@ function Game:draw()
|
||||
-- End
|
||||
love.graphics.setColor(0.88, 0.22, 0.22, 0.20)
|
||||
for _, exit in ipairs(self.env.exits) do
|
||||
love.graphics.rectangle('fill', exit.x, exit.y, TILE_SIZE, TILE_SIZE)
|
||||
love.graphics.rectangle('fill', exit.pos.x, exit.pos.y, TILE_SIZE, TILE_SIZE)
|
||||
end
|
||||
|
||||
-- Enemies
|
||||
@@ -167,9 +162,6 @@ function Game:draw()
|
||||
if i.pos or i.size then
|
||||
ix, iy = i.pos.x, i.pos.y
|
||||
iw, ih = i.size.w, i.size.h
|
||||
elseif i.x or i.y then
|
||||
ix, iy = i.x, i.y
|
||||
iw, ih = TILE_SIZE, TILE_SIZE
|
||||
else
|
||||
ix, iy = unpack(i)
|
||||
iw, ih = TILE_SIZE, TILE_SIZE
|
||||
|
||||
Reference in New Issue
Block a user