bzr branch
http://9ix.org/bzr/ld26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Inventory = Class:extend { items = {}, had = {}, visible = true, add = function(self, item) item.invTile.y = 10 item.invTile.x = 50 * #self.items self.items[item.name] = item the.app.view:flash({0,255,0}) end, remove = function(self, name) self.had[name] = self.items[name] self.items[name] = nil end, draw = function(self) for _, item in pairs(self.items) do item.invTile:draw() end end } the.inventory = Inventory:new() |