2
function Sprite:displaceDir(other, dir, hint)
3
if not self.solid or self == other or not other.solid then return end
4
if STRICT then assert(other:instanceOf(Sprite), 'asked to displace a non-sprite') end
9
for _, spr in pairs(other.sprites) do
10
self:displace(spr, dir)
14
local dim = util.dim(dir)
16
local negMove = (other[dir] - self[dir]) + other[dim]
17
local posMove = (self[dir] + self[dim]) - other[dir]
25
error('hint should be 1, -1, or nil')
28
if negMove < posMove then
36
other[dir] = other[dir] + chg