/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:
3
3
 
4
4
require 'zoetrope'
5
5
vector = require 'vector'
 
6
--inspect = require 'inspect'
6
7
 
7
8
require 'group'
8
9
 
119
120
 
120
121
              the.score = Text:new{
121
122
                 width = the.app.width,
122
 
                 align = 'center',
 
123
                 --align = 'center',
123
124
                 font = 25}
124
125
              self:add(the.score)
125
126
 
146
147
              self.gameStart = love.timer.getTime()
147
148
           end,
148
149
   onUpdate = function(self, dt)
149
 
                 if love.timer.getTime() > self.lastRock + self.rockInterval then
 
150
                 if the.player.active and love.timer.getTime() > self.lastRock + self.rockInterval then
150
151
                    local unseenRock = nil
151
152
                    while not unseenRock do
152
153
                       local rock = Rock:new{
175
176
                 end
176
177
 
177
178
                 the.bullets:collide(the.rockColliders)
 
179
 
 
180
                 -- for _, mirror in ipairs(the.mirrors.sprites) do
 
181
                 --    if not mirror.of then
 
182
                 --       print('mirror:' .. inspect(mirror))
 
183
                 --       error('mirror OF NOTHING')
 
184
                 --    end
 
185
                 -- end
178
186
              end,
179
187
   onEndFrame = function(self)
180
188
                   if the.player.active then
181
 
                      local t = love.timer.getTime() - self.gameStart
182
 
                      local m = t / 60
183
 
                      local s = t % 60
184
 
 
185
 
                      the.score.text = string.format('Score: %d:%02d', m, s)
186
 
                      the.score.y = the.player.y - the.app.height / 2 + the.player.height
187
 
                      the.score.x = the.player.x - the.app.width / 2
 
189
                      self:updateScore()
188
190
                   end
189
 
 
190
 
                   the.highScore.y = the.player.y - the.app.height / 2 + the.player.height
191
 
                   the.highScore.x = the.player.x - the.app.width / 2
192
191
                end,
193
192
   draw = function (self, x, y)
194
193
             View.draw(self, x, y)
195
 
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
196
 
          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
197
208
}
198
209
 
199
210
MenuScreen = View:extend {
224
235
                 self.console:watch('the.player.y', 'the.player.y')
225
236
                 self.console:watch('the.app.width', 'the.app.width')
226
237
                 self.console:watch('the.app.height', 'the.app.height')
 
238
                 self.console:watch('num mirrors', '#the.mirrors.sprites')
 
239
                 self.console:watch('num rocks', '#the.rocks.sprites')
227
240
                 --self.console:watch('drawTook', 'the.drawTook')
228
241
 
229
242
                 -- back off that dark overlay a bit