hi,
i have a collision function and i want to know if the character collides with an enemy jumping over it, but i can´t get the other object´s height.Any idea?
local function onplayerCollision(event)
local fixtureA = event.fixtureA
local fixtureB = event.fixtureB
local bodyA = fixtureA:getBody()
local bodyB = fixtureB:getBody()
local playerBody, other
if bodyA.info.material == "heroe" then
playerBody = bodyA
other = bodyB
elseif bodyB.info.material == "heroe" then
playerBody = bodyB
other = bodyA
end
if playerBody ~= "heroe" and (other.info.material == "enemy" ) then
if player.y < other.y-(other.height*0.5) then --??
display.remove(event.object1); event.object1 = nil --??
else
print("enemycontact")--gameOver()
end
end
end
i use gideros svg level editor
thanks
Comments