From 42303da317a26eda62a2106c29ba2b26ed805094 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 22 Apr 2019 09:42:33 +0200 Subject: [PATCH] modules/world: fix movement functions for bump2D The moveActor function is in bump2D a wrapper for the move function of bump2D. But this function doesn't handle actual movement. In order to make things samewise everywhere, let the actor handle actual movement themselves. --- gamecore/modules/world/actors/actor2D.lua | 3 ++- gamecore/modules/world/baseworld.lua | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index 469bec1..27c2e46 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -84,7 +84,8 @@ function Actor2D:autoMove() end function Actor2D:move(newx, newy) - self.world:moveActor(self, newx, newy) + local cols, colNumber + self.x, self.y, cols, colNumber = self.world:moveActor(self, newx, newy) end -- DRAW FUNCTIONS diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 8cdce50..b6ad080 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -81,8 +81,6 @@ function BaseWorld:removeActor(actor) end function BaseWorld:moveActor(actor, x, y, filter) - actor.x = x - actor.y = y -- as the baseworld have no collision function, we return empty collision -- datas, but from the same type than bump2D will return return x, y, {}, 0