New lighting!
This commit is contained in:
@@ -136,6 +136,14 @@ function TileGetDepth(tile_id)
|
||||
end
|
||||
end
|
||||
|
||||
function TileGetLight(tile_id)
|
||||
for _, properties in ipairs(Tiles) do
|
||||
if properties.id == tile_id then
|
||||
return properties.light
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function GridDisplay()
|
||||
for i = 1, #LevelTiles do
|
||||
for j = 1, #LevelTiles[i] do
|
||||
@@ -160,10 +168,19 @@ function TileCreateObjects()
|
||||
if LevelTiles[i][j] ~= 0 then
|
||||
|
||||
local type = TileGetType(LevelTiles[i][j])
|
||||
|
||||
local light = TileGetLight(LevelTiles[i][j])
|
||||
local base_x = tileProperties.scale * j * tileProperties.width + tileProperties.scale * (levelProperties.offset.x - tileProperties.height)
|
||||
local base_y = tileProperties.scale * i * tileProperties.height + tileProperties.scale * (levelProperties.offset.y - tileProperties.height)
|
||||
|
||||
|
||||
if light ~= 0 and light ~= nil then
|
||||
CreateLight(
|
||||
base_x + tileProperties.width/2 * tileProperties.scale,
|
||||
base_y + tileProperties.height/2 * tileProperties.scale,
|
||||
light
|
||||
)
|
||||
end
|
||||
|
||||
if type == "whole" then
|
||||
local col = Collision:New(
|
||||
base_x,
|
||||
|
||||
Reference in New Issue
Block a user