function love.load() love.graphics.setBackgroundColor(1, 1, .75) level = { {' ', ' ', '#', '#', '#'}, {' ', ' ', '#', '.', '#'}, {' ', ' ', '#', ' ', '#', '#', '#', '#'}, {'#', '#', '#', '$', ' ', '$', '.', '#'}, {'#', '.', ' ', '$', '@', '#', '#', '#'}, {'#', '#', '#', '#', '$', '#'}, {' ', ' ', ' ', '#', '.', '#'}, {' ', ' ', ' ', '#', '#', '#'}, } player = '@' playerOnStorage = '+' box = '$' boxOnStorage = '*' storage = '.' wall = '#' empty = ' ' end function love.draw() for y, row in ipairs(level) do for x, cell in ipairs(row) do if cell ~= empty then local cellSize = 23 local colors = { [player] = {.64, .53, 1}, [playerOnStorage] = {.62, .47, 1}, [box] = {1, .79, .49}, [boxOnStorage] = {.59, 1, .5}, [storage] = {.61, .9, 1}, [wall] = {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