/traderous

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-05-20 16:58:11 UTC
  • Revision ID: josh@9ix.org-20130520165811-wt18btbst2h0ftr6
remove fps counter

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
 
121
121
              the.score = Text:new{
122
122
                 width = the.app.width,
123
 
                 align = 'center',
 
123
                 --align = 'center',
124
124
                 font = 25}
125
125
              self:add(the.score)
126
126
 
147
147
              self.gameStart = love.timer.getTime()
148
148
           end,
149
149
   onUpdate = function(self, dt)
150
 
                 if love.timer.getTime() > self.lastRock + self.rockInterval then
 
150
                 if the.player.active and love.timer.getTime() > self.lastRock + self.rockInterval then
151
151
                    local unseenRock = nil
152
152
                    while not unseenRock do
153
153
                       local rock = Rock:new{
186
186
              end,
187
187
   onEndFrame = function(self)
188
188
                   if the.player.active then
189
 
                      local t = love.timer.getTime() - self.gameStart
190
 
                      local m = t / 60
191
 
                      local s = t % 60
192
 
 
193
 
                      the.score.text = string.format('Score: %d:%02d', m, s)
194
 
                      the.score.y = the.player.y - the.app.height / 2 + the.player.height
195
 
                      the.score.x = the.player.x - the.app.width / 2
 
189
                      self:updateScore()
196
190
                   end
197
 
 
198
 
                   the.highScore.y = the.player.y - the.app.height / 2 + the.player.height
199
 
                   the.highScore.x = the.player.x - the.app.width / 2
200
191
                end,
201
192
   draw = function (self, x, y)
202
193
             View.draw(self, x, y)
203
 
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
204
 
          end
 
194
             --love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
 
195
          end,
 
196
   updateScore = function(self)
 
197
                    local t = love.timer.getTime() - self.gameStart
 
198
                    local m = t / 60
 
199
                    local s = t % 60
 
200
 
 
201
                    the.score.text = string.format('Score: %d:%02d', m, s)
 
202
                    the.score.y = the.player.y - the.app.height / 2 + the.player.height
 
203
                    the.score.x = the.player.x - the.app.width / 2 + the.player.width
 
204
 
 
205
                    the.highScore.y = the.player.y - the.app.height / 2 + the.player.height
 
206
                    the.highScore.x = the.player.x - the.app.width / 2
 
207
                 end
205
208
}
206
209
 
207
210
MenuScreen = View:extend {
233
236
                 self.console:watch('the.app.width', 'the.app.width')
234
237
                 self.console:watch('the.app.height', 'the.app.height')
235
238
                 self.console:watch('num mirrors', '#the.mirrors.sprites')
 
239
                 self.console:watch('num rocks', '#the.rocks.sprites')
236
240
                 --self.console:watch('drawTook', 'the.drawTook')
237
241
 
238
242
                 -- back off that dark overlay a bit