/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-30 23:38:00 UTC
  • Revision ID: josh@9ix.org-20130630233800-j2wia0e66isl8p00
track kills

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
                           }
70
70
                           self.lastFired = love.timer.getTime()
71
71
                     end
72
 
 
73
 
                     if the.keys:justPressed('x') then
74
 
                        --self:doHit()
75
 
                     end
76
72
                  end,
77
73
   onUpdate = function(self)
78
74
                 self.thrust.x = self.x - self.width
82
78
   onEndFrame = function(self)
83
79
                   self:collide(the.rockColliders)
84
80
                end,
85
 
   doHit = function(self)
86
 
              if self.shield.strength == 0 then
87
 
                 -- die
88
 
                 the.app.view:add( Boom:new {
89
 
                                      x = self.x,
90
 
                                      y = self.y,
91
 
                                      velocity = { rotation = 5 }
92
 
                                   })
93
 
 
94
 
                 self:die()
95
 
                 self.thrust:die()
96
 
              else
97
 
                 self.shield:onHit()
98
 
              end
99
 
 
100
 
              if not self.active then
101
 
                 the.interface:add(GameOver:new())
102
 
              end
103
 
           end,
104
81
   onCollide = function(self, other)
105
82
                  if other:instanceOf(Bullet) and other.source ~= self then
106
 
                     self:doHit()
 
83
                     if self.shield.strength == 0 then
 
84
                        -- die
 
85
                        the.app.view:add( Boom:new {
 
86
                                             x = self.x,
 
87
                                             y = self.y,
 
88
                                             velocity = { rotation = 5 }
 
89
                                          })
 
90
 
 
91
                        self:die()
 
92
                        self.thrust:die()
 
93
                     else
 
94
                        self.shield:onHit()
 
95
                     end
107
96
 
108
97
                     other:die()
109
98
                     the.bullets:remove(other)
119
108
                     self:die()
120
109
                     self.thrust:die()
121
110
                  end
 
111
 
 
112
                  if not self.active then
 
113
                     the.interface:add(GameOver:new())
 
114
                  end
122
115
               end,
123
116
   buy = function(self, good, price)
124
117
            if self.money >= price and self:availableSpace() > 0 then