/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:
77
77
                  if minVel[dir] and vel[dir] < minVel[dir] then vel[dir] = minVel[dir] end
78
78
                  if maxVel[dir] and vel[dir] > maxVel[dir] then vel[dir] = maxVel[dir] end
79
79
 
 
80
                  -- ugly hack for falling through floor on really slow frames
 
81
                  if math.abs(vel[dir] * elapsed) > 32 then
 
82
                     print('skip')
 
83
                     return
 
84
                  end
 
85
 
80
86
                  if vel[dir] ~= 0 then self[dir] = self[dir] + vel[dir] * elapsed end
81
87
 
82
88
                  if self[dir] < 0 then self[dir] = 0 end
226
232
   other[dir] = other[dir] + chg
227
233
end
228
234
 
 
235
-- don't use zoetrope physics
 
236
function Sprite:update (elapsed)
 
237
   if self.onUpdate then self:onUpdate(elapsed) end
 
238
end
 
239
 
229
240
GameView = View:extend {
230
241
   onNew = function (self)
231
242
              self:loadLayers('data/map.lua')
233
244
              self:clampTo(self.map)
234
245
           end,
235
246
   onUpdate = function (self)
 
247
                 --print('drawTook: ', the.drawTook)
236
248
                 --print('tick')
237
249
                 --the.player:collide(self.map)
238
250
                 --self.map:collide(the.player)