/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-08 00:02:37 UTC
  • Revision ID: josh@9ix.org-20130608000237-v50hyqvrinp5g4rs
try to make setting screen resolution more reliable

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,
60
58
                           b = Bullet:new{
61
59
                              x = self.x + self.width / 2,
62
60
                              y = self.y + self.height / 2,
63
 
                              rotation = self.rotation
64
61
                           }
65
62
                           self.lastFired = love.timer.getTime()
66
63
                     end
98
95
                        )
99
96
                     end
100
97
                  end
101
 
               end,
102
 
   buy = function(self, good, price)
103
 
            if self.money >= price then
104
 
               self.goods[good] = (self.goods[good] or 0) + 1
105
 
               self.money = self.money - price
106
 
            end
107
 
         end,
108
 
   sell = function(self, good, price)
109
 
             if self.goods[good] and self.goods[good] > 0 then
110
 
                self.goods[good] = self.goods[good] - 1
111
 
                self.money = self.money + price
112
 
             end
113
 
          end
 
98
               end
114
99
}
 
 
b'\\ No newline at end of file'