Added some nice lighting to maps

This commit is contained in:
Linus Probert 2017-12-11 11:53:18 +01:00
parent 9f71d23849
commit 9eab032a71
1 changed files with 24 additions and 8 deletions

View File

@ -29,7 +29,7 @@ local wall = {
} }
local floorDecor = { } local floorDecor = { }
local wallDecor = { } local lightDecor = { }
local function load_decor_textures() local function load_decor_textures()
td0 = add_texture(map, "assets/Objects/Decor0.png") td0 = add_texture(map, "assets/Objects/Decor0.png")
@ -96,8 +96,9 @@ local function load_decor_textures()
--table.insert(floorDecor, { td0, td1, 3 * 16, 20 * 16, true }) --table.insert(floorDecor, { td0, td1, 3 * 16, 20 * 16, true })
--table.insert(floorDecor, { td0, td1, 4 * 16, 20 * 16, true }) --table.insert(floorDecor, { td0, td1, 4 * 16, 20 * 16, true })
wallDecor.candle0 = { td0, td1, 0, 8 * 16, false, true } lightDecor.candle0 = { td0, td1, 0, 8 * 16, false, true }
wallDecor.candle1 = { td0, td1, 16, 8 * 16, false, true } lightDecor.candle1 = { td0, td1, 16, 8 * 16, false, true }
lightDecor.candle2 = { td0, td1, 32, 8 * 16, true, true }
end end
function load_textures(map) function load_textures(map)
@ -195,16 +196,12 @@ local function add_walls_to_room (map)
for j=0,11 do for j=0,11 do
if (i == 0 and j == 0) then if (i == 0 and j == 0) then
add_tile(map, i, j, repack(wall.topleft)) add_tile(map, i, j, repack(wall.topleft))
--add_decoration(map, i, j, repack(wallDecor.candle0))
elseif (i == 15 and j == 0) then elseif (i == 15 and j == 0) then
add_tile(map, i, j, repack(wall.topright)) add_tile(map, i, j, repack(wall.topright))
--add_decoration(map, i, j, repack(wallDecor.candle0))
elseif (i == 0 and j == 11) then elseif (i == 0 and j == 11) then
add_tile(map, i, j, repack(wall.bottomleft)) add_tile(map, i, j, repack(wall.bottomleft))
--add_decoration(map, i, j, repack(wallDecor.candle0))
elseif (i == 15 and j == 11) then elseif (i == 15 and j == 11) then
add_tile(map, i, j, repack(wall.bottomright)) add_tile(map, i, j, repack(wall.bottomright))
--add_decoration(map, i, j, repack(wallDecor.candle0))
elseif (i == 0 or i == 15) then elseif (i == 0 or i == 15) then
add_tile(map, i, j, repack(wall.vertical)) add_tile(map, i, j, repack(wall.vertical))
elseif (j == 0 or j == 11) then elseif (j == 0 or j == 11) then
@ -212,6 +209,13 @@ local function add_walls_to_room (map)
end end
end end
end end
if random(2) == 1 then
add_decoration(map, 4, 3, repack(lightDecor.candle2))
add_decoration(map, 11, 3, repack(lightDecor.candle2))
add_decoration(map, 4, 9, repack(lightDecor.candle2))
add_decoration(map, 11, 9, repack(lightDecor.candle2))
end
end end
local function add_exit(map, direction) local function add_exit(map, direction)
@ -255,6 +259,12 @@ local function build_vert_center_coridoor(map, offset)
add_tile(map, 8, offset+j, repack(floor.center)); add_tile(map, 8, offset+j, repack(floor.center));
add_tile(map, 9, offset+j, repack(wall.vertical)); add_tile(map, 9, offset+j, repack(wall.vertical));
end end
if random(2) == 1 then
add_decoration(map, 6, offset + 2, repack(lightDecor.candle1))
end
if random(2) == 1 then
add_decoration(map, 9, offset + 2, repack(lightDecor.candle1))
end
end end
local function build_horiz_center_coridoor(map, offset) local function build_horiz_center_coridoor(map, offset)
@ -264,6 +274,12 @@ local function build_horiz_center_coridoor(map, offset)
add_tile(map, offset+i, 6, repack(floor.center)); add_tile(map, offset+i, 6, repack(floor.center));
add_tile(map, offset+i, 7, repack(wall.horizontal)); add_tile(map, offset+i, 7, repack(wall.horizontal));
end end
if random(2) == 1 then
add_decoration(map, offset+3, 4, repack(lightDecor.candle1))
end
if random(2) == 1 then
add_decoration(map, offset+3, 7, repack(lightDecor.candle1))
end
end end
local function build_center_corner_walls(map, exits) local function build_center_corner_walls(map, exits)