feat(world3D): allow creating collision from their top side

This commit is contained in:
Kazhnuz 2019-07-16 10:53:36 +02:00
parent 22c8617717
commit c04d9f3ba1

View file

@ -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)