Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 113e76d1c9
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (20 sloc) 0.674 kb
function make_collidable(class)
class._onCollide = {}
class._onStopCollide = {}
function class:onCollide(group, reaction)
self._onCollide[group] = reaction
end
function class:onStopCollide(group, reaction)
self._onStopCollide[group] = reaction
end
function class:register(group, onCollide, onStop)
class:onCollide(group, onCollide)
class:onStopCollide(group, onStop)
end
function class:collideWith(other,dx,dy)
(self._onCollide[other.group] or self._onCollide["*"] or _NULL_)(self, other, dx,dy)
end
function class:stopCollideWith(other,dx,dy)
(self._onStopCollide[other.group] or self._onStopCollide["*"] or _NULL_)(self, other, dx,dy)
end
end
Jump to Line
Something went wrong with that request. Please try again.