/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-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

Lines of Context:
26
26
   maxVelocity = {x=velLimit,y=velLimit},
27
27
   minVelocity = {x=-velLimit, y=-velLimit},
28
28
   lastFired = 0,
29
 
   money = 2000, -- what to use for money symbol? ✪ or ☥ or Ⓐ?
30
 
   goods = {},
31
29
   onNew = function(self)
32
30
              self.thrust = Tile:new{image = 'data/thrust.png'}
33
31
           end,
97
95
                        )
98
96
                     end
99
97
                  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
 
98
               end
113
99
}
 
 
b'\\ No newline at end of file'