/traderous

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

                    if pvec:len2() < hw ^ 2 then
                       tradeView = TradeView:new{ planet = self }
                       tradeView:activate()
                    end
                 end
              end
}