/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-17 21:23:13 UTC
  • Revision ID: josh@9ix.org-20130317212313-gsmwb0yt9hxdjj68
hack to not fall through floor on long first tick, monkey patch to turn 
off zoetrope physics (reliably, without depending on patched zoetrope)

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)
262
248
                 --print('tick')
263
249
                 --the.player:collide(self.map)
264
250
                 --self.map:collide(the.player)
265
 
              end,
266
 
   -- draw = function (self, x, y)
267
 
   --           View.draw(self, x, y)
268
 
 
269
 
   --           love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
270
 
   --        end
 
251
              end
271
252
}
272
253
 
273
254
the.app = App:new {
277
258
              self.console:watch('onWall', 'the.player.onWall')
278
259
              self.console:watch('updateTook', 'the.updateTook')
279
260
              self.console:watch('drawTook', 'the.drawTook')
280
 
              self.console:watch('recorder state', 'the.recorder.state')
281
261
 
282
262
              --the.profiler = newProfiler('time', 2000)
283
263
              --the.profiler = newProfiler()
292
272
                       outfile:close()
293
273
                    end
294
274
 
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
275
                    self.quit()
308
276
                 end
309
277
              end,