From 93f710e0b0abead8de072223fcdea40083b3f15f Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 22 Apr 2019 11:58:00 +0200 Subject: [PATCH] modules/world: add filter function --- gamecore/modules/world/actors/actor2D.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index 27c2e46..d8c6be4 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -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