/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-06-16 03:32:01 UTC
  • Revision ID: josh@9ix.org-20130616033201-91uqlfnqa6cgo989
make sure every planet trades something

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
   minVelocity = {x=-velLimit, y=-velLimit},
28
28
   lastFired = 0,
29
29
   money = 2000, -- what to use for money symbol? ✪ or ☥ or Ⓐ?
 
30
   goods = {},
30
31
   onNew = function(self)
31
32
              self.thrust = Tile:new{image = 'data/thrust.png'}
32
33
           end,
96
97
                        )
97
98
                     end
98
99
                  end
99
 
               end
 
100
               end,
 
101
   buy = function(self, good, price)
 
102
            if self.money >= price then
 
103
               self.goods[good] = (self.goods[good] or 0) + 1
 
104
               self.money = self.money - price
 
105
            end
 
106
         end,
 
107
   sell = function(self, good, price)
 
108
             if self.goods[good] and self.goods[good] > 0 then
 
109
                self.goods[good] = self.goods[good] - 1
 
110
                self.money = self.money + price
 
111
             end
 
112
          end
100
113
}
 
 
b'\\ No newline at end of file'