Code: Select all
inventory = { x=400, y=20,
}
function inventory.load()
end
function inventory.add(id)
table.insert(inventory, love.graphics.newImage("Items/".. id ..".bmp"))
end
function inventory.update(dt)
end
function inventory.draw()
love.graphics.setColor(0,0,0,120)
love.graphics.rectangle("fill", inventory.x+37, inventory.y, 32*4+5+(4*5), 32*4+5+(4*5))
love.graphics.setColor(255,255,255,255)
if inventory[1] then
for i = 1,#inventory do
love.graphics.draw(inventory[i], inventory.x+i*32+5+(i*5), inventory.y+5)
end
end
end
function inventory.mousepressed(x,y,z)
end
Also, When you have 5 items, it draws them on the same y. How would I change this so after 4 items it goes to the first slot of the next y (inventory.y+5)?