/spacey

To get this branch, use:
bzr branch http://9ix.org/bzr/spacey

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-05-13 21:25:26 UTC
  • Revision ID: josh@9ix.org-20130513212526-3q6md6n9xzhcmoa6
and that fixes the corner bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
                       the.cursor:inTargetArea() then
52
52
                           --print('pew')
53
53
                           b = Bullet:new{
54
 
                              x = self.x + self.width / 2,
55
 
                              y = self.y + self.height / 2,
 
54
                              x = self.x, y = self.y,
56
55
                           }
 
56
                           the.app.view:add(b)
57
57
                           self.lastFired = love.timer.getTime()
58
58
                     end
59
59
                  end,
60
60
   onUpdate = function(self)
61
 
              end,
62
 
   onEndFrame = function(self)
63
 
                   self:collide(the.rockColliders)
64
 
                end,
65
 
   onCollide = function(self, other)
66
 
                  if other:instanceOf(RockCollider) then
67
 
                     the.app.view:add( Boom:new {
68
 
                                          x = self.x,
69
 
                                          y = self.y,
70
 
                                          velocity = { rotation = 5 }
71
 
                                       })
72
 
 
73
 
                     self:die()
74
 
 
75
 
                     local over = Text:new{
76
 
                        y = self.y,
77
 
                        x = self.x - the.app.width / 2,
78
 
                        width = the.app.width,
79
 
                        align = 'center',
80
 
                        font = 25,
81
 
                        text = "Game Over" }
82
 
                     the.app.view:add(over)
83
 
 
84
 
                     the.app.view:updateScore()
85
 
 
86
 
                     local score = love.timer.getTime() - the.app.view.gameStart
87
 
                     if score > the.storage.data.highScore then
88
 
                        the.storage.data.highScore = score
89
 
                        the.storage:save()
90
 
 
91
 
                        the.highScore.text = string.format(
92
 
                           'High Score: %d:%02d', score / 60, score % 60
93
 
                        )
94
 
                     end
95
 
                  end
96
 
               end
 
61
              end
97
62
}
 
 
b'\\ No newline at end of file'