1
-- monkey patches for zoetrope Sprite
3
-- displace on a specific axis
4
function Sprite:displaceDir(other, dir, hint)
5
if not self.solid or self == other or not other.solid then return end
6
if STRICT then assert(other:instanceOf(Sprite), 'asked to displace a non-sprite') end
11
for _, spr in pairs(other.sprites) do
12
self:displace(spr, dir)
16
local dim = util.dim(dir)
18
local negMove = (other[dir] - self[dir]) + other[dim]
19
local posMove = (self[dir] + self[dim]) - other[dir]
27
error('hint should be 1, -1, or nil')
30
if negMove < posMove then
38
other[dir] = other[dir] + chg