/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-05-29 02:51:39 UTC
  • Revision ID: josh@9ix.org-20130529025139-g8sboz3p23excyz4
F1 = screenshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
local velLimit = 400
23
23
--local velLimit = 50
24
 
SpacePlayer = Tile:extend{
 
24
SpacePlayer = WrapTile:extend{
25
25
   image = 'data/ship.png',
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'