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