/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-23 02:05:10 UTC
  • Revision ID: josh@9ix.org-20130623020510-i4t86yocvbjab19o
higher planet floor, recharge shields when you land, stop moving when you land

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
                           b = Bullet:new{
62
62
                              x = self.x + self.width / 2,
63
63
                              y = self.y + self.height / 2,
64
 
                              rotation = self.rotation
 
64
                              rotation = self.rotation,
 
65
                              source = self
65
66
                           }
66
67
                           self.lastFired = love.timer.getTime()
67
68
                     end
75
76
                   self:collide(the.rockColliders)
76
77
                end,
77
78
   onCollide = function(self, other)
78
 
                  if other:instanceOf(Bullet) then
 
79
                  if other:instanceOf(Bullet) and other.source ~= self then
79
80
                     if self.shield.strength == 0 then
80
81
                        -- die
81
82
                        the.app.view:add( Boom:new {
88
89
                        self.thrust:die()
89
90
                     else
90
91
                        self.shield:onHit()
91
 
                        other:die()
92
 
                        the.bullets:remove(other)
93
92
                     end
 
93
 
 
94
                     other:die()
 
95
                     the.bullets:remove(other)
94
96
                  end
95
97
 
96
98
                  if other:instanceOf(RockCollider) then
102
104
 
103
105
                     self:die()
104
106
                     self.thrust:die()
 
107
                  end
105
108
 
 
109
                  if not self.active then
106
110
                     the.over.visible = true
107
111
                     the.instructions.visible = true
108
 
                     the.app.view:updateScore()
109
 
 
110
 
                     local score = love.timer.getTime() - the.app.view.gameStart
111
 
                     if score > the.storage.data.highScore then
112
 
                        the.storage.data.highScore = score
113
 
                        the.storage:save()
114
 
 
115
 
                        the.highScore.text = string.format(
116
 
                           'High Score: %d:%02d', score / 60, score % 60
117
 
                        )
118
 
                     end
119
112
                  end
120
113
               end,
121
114
   buy = function(self, good, price)