modules/world: add filter function

This commit is contained in:
Kazhnuz 2019-04-22 11:58:00 +02:00
parent c4ef90dcdf
commit 93f710e0b0

View file

@ -51,6 +51,8 @@ function Actor2D:initPhysics(x, y, w, h)
self.xsp = 0
self.ysp = 0
self:setFilter()
end
function Actor2D:register()
@ -79,13 +81,20 @@ end
-- MOVEMENT FUNCTIONS
-- Basic functions from the movement.
function Actor2D:setFilter()
-- Init the bump filter
self.filter = function(item, other)
return nil
end
end
function Actor2D:autoMove()
self:move(self.x + self.xsp, self.y + self.ysp)
end
function Actor2D:move(newx, newy)
local cols, colNumber
self.x, self.y, cols, colNumber = self.world:moveActor(self, newx, newy)
self.x, self.y, cols, colNumber = self.world:moveActor(self, newx, newy, self.filter)
end
-- DRAW FUNCTIONS