/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-16 19:31:02 UTC
  • Revision ID: josh@9ix.org-20130316193102-68imraus0srbj653
don't go off the edge

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
 
 
86
80
                  if vel[dir] ~= 0 then self[dir] = self[dir] + vel[dir] * elapsed end
87
81
 
88
82
                  if self[dir] < 0 then self[dir] = 0 end
232
226
   other[dir] = other[dir] + chg
233
227
end
234
228
 
235
 
function Sprite:update (elapsed)
236
 
   if self.onUpdate then self:onUpdate(elapsed) end
237
 
end
238
 
 
239
229
GameView = View:extend {
240
230
   onNew = function (self)
241
231
              self:loadLayers('data/map.lua')
244
233
              self:clampTo(self.map)
245
234
           end,
246
235
   onUpdate = function (self)
247
 
                 --print('drawTook: ', the.drawTook)
248
236
                 --print('tick')
249
237
                 --the.player:collide(self.map)
250
238
                 --self.map:collide(the.player)
251
 
              end,
252
 
   draw = function (self, x, y)
253
 
             View.draw(self, x, y)
254
 
 
255
 
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
256
 
          end
 
239
              end
257
240
}
258
241
 
259
242
the.app = App:new {