/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 02:57:09 UTC
  • Revision ID: josh@9ix.org-20130616025709-wt230osrvs3w0scq
status of what player has

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 = {},
29
31
   onNew = function(self)
30
32
              self.thrust = Tile:new{image = 'data/thrust.png'}
31
33
           end,
95
97
                        )
96
98
                     end
97
99
                  end
98
 
               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
99
113
}
 
 
b'\\ No newline at end of file'