modules/world: add filter function
This commit is contained in:
parent
c4ef90dcdf
commit
93f710e0b0
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue