From c04d9f3ba161734cc7cbf79d7c48308f94d27ec4 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Tue, 16 Jul 2019 10:53:36 +0200 Subject: [PATCH] feat(world3D): allow creating collision from their top side --- gamecore/modules/world/world3D.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gamecore/modules/world/world3D.lua b/gamecore/modules/world/world3D.lua index 0bc7139..9d6a98a 100644 --- a/gamecore/modules/world/world3D.lua +++ b/gamecore/modules/world/world3D.lua @@ -131,7 +131,16 @@ end function World3D:newCollisionFromMap(objectlayer, object) local z = object.properties.z or 0 local d = object.properties.d or 16 - self:newCollision(objectlayer.name, object.x, object.y, z, object.width, object.height, d) + local fromTop = object.properties.fromTop or false + + local y = object.y + if (fromTop) then + print("create from top, set z and y:", z, y, "=>", z-d, y+z) + y = y + z + z = z - d + end + + self:newCollision(objectlayer.name, object.x, y, z, object.width, object.height, d) end function World3D:addPlayerFromMap(object, i)