function love.load() love.graphics.setBackgroundColor(1, 1, .75) level = { {' ', ' ', '#', '#', '#'}, {' ', ' ', '#', '.', '#'}, {' ', ' ', '#', ' ', '#', '#', '#', '#'}, {'#', '#', '#', '$', ' ', '$', '.', '#'}, {'#', '.', ' ', '$', '@', '#', '#', '#'}, {'#', '#', '#', '#', '$', '#'}, {' ', ' ', ' ', '#', '.', '#'}, {' ', ' ', ' ', '#', '#', '#'}, } end function love.draw() for y, row in ipairs(level) do for x, cell in ipairs(row) do if cell ~= ' ' then local cellSize = 23 local colors = { ['@'] = {.64, .53, 1}, ['+'] = {.62, .47, 1}, ['$'] = {1, .79, .49}, ['*'] = {.59, 1, .5}, ['.'] = {.61, .9, 1}, ['#'] = {1, .58, .82}, } love.graphics.setColor(colors[cell]) love.graphics.rectangle( 'fill', (x - 1) * cellSize, (y - 1) * cellSize, cellSize, cellSize ) love.graphics.setColor(1, 1, 1) love.graphics.print( level[y][x], (x - 1) * cellSize, (y - 1) * cellSize ) end end end end