bzr branch
http://9ix.org/bzr/traderous
53
by Josh C
beginnings of trading interface |
1 |
Planet = Tile:extend { |
2 |
image = 'data/planet1.png', |
|
3 |
goods = { |
|
4 |
{'Bobble-Headed Dolls', 100}, |
|
5 |
{'Alliance Foodstuffs', 400}, |
|
6 |
{'Moonbrained Passengers', 6000}, |
|
7 |
}, |
|
8 |
onNew = function (self) |
|
9 |
self.indicator = Tile:new{ image = 'data/planet1ind.png' } |
|
10 |
the.indicators:add(self.indicator) |
|
11 |
end, |
|
12 |
onUpdate = function (self) |
|
13 |
if the.keys:justPressed('l') then |
|
14 |
local hw = self.width / 2 |
|
15 |
local pvec = vector.new(the.player.x - (self.x + hw), |
|
16 |
the.player.y - (self.y + hw)) |
|
17 |
||
18 |
if pvec:len2() < hw ^ 2 then |
|
19 |
tradeView = TradeView:new{ planet = self } |
|
20 |
tradeView:activate() |
|
21 |
end |
|
22 |
end |
|
23 |
end |
|
24 |
} |