/spacey

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-05-16 02:07:23 UTC
  • Revision ID: josh@9ix.org-20130516020723-ntq1ydr2fczd9w5b
stick things into layers

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
              the.cursor = Cursor:new()
111
111
              self:add(the.cursor)
112
112
 
113
 
              the.score = Text:new{
114
 
                 width = the.app.width,
115
 
                 align = 'center',
116
 
                 font = 25}
117
 
              self:add(the.score)
118
 
 
119
113
              love.mouse.setGrab(true)
120
114
              love.mouse.setVisible(false)
121
 
              love.mouse.setPosition(the.app.width / 2, the.app.height / 2)
122
115
 
123
116
              --self:loadLayers('data/map.lua')
124
117
              self.focus = the.player
157
150
 
158
151
                 the.bullets:collide(the.rockColliders)
159
152
              end,
160
 
   onEndFrame = function(self)
161
 
                   if the.player.active then
162
 
                      local t = love.timer.getTime() - self.gameStart
163
 
                      local m = t / 60
164
 
                      local s = t % 60
165
 
 
166
 
                      the.score.text = string.format('Score: %d:%02d', m, s)
167
 
                      the.score.y = the.player.y - the.app.height / 2 + the.player.height
168
 
                      the.score.x = the.player.x - the.app.width / 2
169
 
                   end
170
 
                end,
171
153
   draw = function (self, x, y)
172
154
             View.draw(self, x, y)
173
155
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)