Hello,
I have been using this collision code when a ball touches line. When the ball touches line, there is another line “line2” that pops up in a different position. The ball later SHOULD touch line2 and perform a collision. The problem is every time i try to add physics to line2, the simulator crashes. Can i not add physics to collision objects? Any help please?
Thanks.
[code]
ball.myName = “ball”
line.myName = “line”
ball:addEventListener(“collision”,ball)
function ball:collision (event)
if event.other.myName == “line” then
local line2=display.newImageRect(“line.png”,400,10)
line2.x=display.contentWidth/2
line2.y=display.contentHeight/1.3
line2.rotation=30
physics.addBody(line2, “static”, {friction=0.3,bounce=0.3})
end
end
[import]uid: 23689 topic_id: 12372 reply_id: 312372[/import]