/zoeplat

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

« back to all changes in this revision

Viewing changes to zoetrope/core/sprite.lua

  • Committer: Josh C
  • Date: 2013-03-09 06:03:56 UTC
  • Revision ID: josh@9ix.org-20130309060356-qvi2yd0odhfr3e6t
try to track X collisions.  break out Sprite's physics in prep for 
overriding them completely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
350
350
                if self.onStartFrame then self:onStartFrame(elapsed) end
351
351
        end,
352
352
 
353
 
        update = function (self, elapsed)
 
353
        doPhysics = function (self, elapsed)
354
354
                local vel = self.velocity
355
355
                local acc = self.acceleration
356
356
                local drag = self.drag
425
425
                if vel.x ~= 0 then self.x = self.x + vel.x * elapsed end
426
426
                if vel.y ~= 0 then self.y = self.y + vel.y * elapsed end
427
427
                if vel.rotation ~= 0 then self.rotation = self.rotation + vel.rotation * elapsed end
 
428
        end,
 
429
        update = function (self, elapsed)
 
430
                    self:doPhysics(elapsed)
428
431
 
429
 
                if self.onUpdate then self:onUpdate(elapsed) end
 
432
                    if self.onUpdate then self:onUpdate(elapsed) end
430
433
        end,
431
434
 
432
435
        endFrame = function (self, elapsed)