/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-20 17:57:53 UTC
  • Revision ID: josh@9ix.org-20130520175753-yvanutc9jnm8lzbt
quit and restart

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, y = self.y,
 
54
                              x = self.x + self.width / 2,
 
55
                              y = self.y + self.height / 2,
55
56
                           }
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
 
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
                     the.over.visible = true
 
76
                     the.instructions.visible = true
 
77
                     the.app.view:updateScore()
 
78
 
 
79
                     local score = love.timer.getTime() - the.app.view.gameStart
 
80
                     if score > the.storage.data.highScore then
 
81
                        the.storage.data.highScore = score
 
82
                        the.storage:save()
 
83
 
 
84
                        the.highScore.text = string.format(
 
85
                           'High Score: %d:%02d', score / 60, score % 60
 
86
                        )
 
87
                     end
 
88
                  end
 
89
               end
62
90
}
 
 
b'\\ No newline at end of file'