/traderous

To get this branch, use:
bzr branch /bzr/traderous

« back to all changes in this revision

Viewing changes to planet.lua

  • Committer: Josh C
  • Date: 2013-06-15 16:59:30 UTC
  • Revision ID: josh@9ix.org-20130615165930-iud659qdwcvjlnoh
beginnings of trading interface

Show diffs side-by-side

added added

removed removed

 
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
}
 
 
'\\ No newline at end of file'