/zoeplat

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-03-20 01:30:46 UTC
  • Revision ID: josh@9ix.org-20130320013046-da2g35k1jzxdihlz
fps indicator, maybe a new tile

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
STRICT = true
2
2
DEBUG = true
3
 
RECORD = true
4
 
PLAYBACK = false
5
3
 
6
4
require 'zoetrope'
7
5
__ = require 'underscore'
15
13
      elseif dir == 'y' then
16
14
         return 'height'
17
15
      else
18
 
         if STRICT then error('dir '..dir) end
 
16
         print 'dir ??'
19
17
      end
20
18
   end
21
19
}
244
242
              self:loadLayers('data/map.lua')
245
243
              self.focus = the.player
246
244
              self:clampTo(self.map)
247
 
 
248
 
              the.recorder = Recorder:new{mousePosInterval = 9999}
249
 
              the.app.meta:add(the.recorder)
250
 
              if RECORD then
251
 
                 the.recorder:startRecording()
252
 
              elseif PLAYBACK then
253
 
                 local storage = Storage:new{filename = 'record.lua'}
254
 
                 storage:load()
255
 
                 --print(inspect(storage.data))
256
 
                 the.recorder.record = storage.data
257
 
                 the.recorder:startPlaying()
258
 
              end
259
245
           end,
260
246
   onUpdate = function (self)
261
247
                 --print('drawTook: ', the.drawTook)
263
249
                 --the.player:collide(self.map)
264
250
                 --self.map:collide(the.player)
265
251
              end,
266
 
   -- draw = function (self, x, y)
267
 
   --           View.draw(self, x, y)
 
252
   draw = function (self, x, y)
 
253
             View.draw(self, x, y)
268
254
 
269
 
   --           love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
270
 
   --        end
 
255
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
 
256
          end
271
257
}
272
258
 
273
259
the.app = App:new {
277
263
              self.console:watch('onWall', 'the.player.onWall')
278
264
              self.console:watch('updateTook', 'the.updateTook')
279
265
              self.console:watch('drawTook', 'the.drawTook')
280
 
              self.console:watch('recorder state', 'the.recorder.state')
281
266
 
282
267
              --the.profiler = newProfiler('time', 2000)
283
268
              --the.profiler = newProfiler()
292
277
                       outfile:close()
293
278
                    end
294
279
 
295
 
                    if RECORD then
296
 
                       if not love.filesystem.remove('record.lua') then
297
 
                          error('could not remove record.lua')
298
 
                       end
299
 
                       local storage = Storage:new{
300
 
                          data = the.recorder.record,
301
 
                          filename = 'record.lua'
302
 
                       }
303
 
                       storage:save(false)
304
 
                       --print(inspect(the.recorder.record))
305
 
                    end
306
 
 
307
280
                    self.quit()
308
281
                 end
309
282
              end,