I have been trying to figure this out how to how make a character jump through a platform. Every time I make the character jump through it does not become solid I read every description about collision. Read, read, and read found other forums but those did not help.
Can anyone please help this is how I have the code:
[code]
local fi = sprite.newSprite (heroset)
–local player = display.newImageRect(“Player.png”, 50, 50)
fi.x = 240
fi.y = 100
physics.addBody(fi, “dynamic” , { density = 10, isSensor = false})
game:insert(fi)
local plat = display.newRect(0,0, 100, 10)
plat.x = 330
plat.y = 220
plat.hit = “plat”
physics.addBody(plat, “static” , {isSensor = true})
game:insert(plat)
fi:addEventListener(“preCollision”, fi)
fi.preCollision = onLocalPreCollision
function fi:preCollision (event)
if event.other.hit == “plat” true then
physics.addBody(plat, “static” , {isSensor = false})
end
end[/code]
Ive been so stressed out about it. Can any please help thanks
[import]uid: 17058 topic_id: 26378 reply_id: 326378[/import]