How do I see the force of a collision?
Current code doesn’t work, it produces “nil”.
[lua]local onsqCollision = function( self, event )
print(event.force)
end
local function buildsquare( sx, sy, img, isdrag, isbreak, breakscore )
local sq = display.newImage(img)
sq.x = sx; sq.y = sy
sq.myName = “breakblock” … math.random()
if (isdrag == 1) then
sq:addEventListener(“touch”, gameUI.dragBody)
end
if (isbreak == 1) then
sq.breakvalue = breakscore
sq.collision = onsqCollision
sq:addEventListener( “collision”, sq)
end
physics.addBody(sq)
end
buildsquare( 200, 200, “crate.png”, 1, 1, 1000)
buildsquare( 100, 200, “crate.png”, 1, 1, 1000)[/lua]
[import]uid: 21962 topic_id: 5986 reply_id: 305986[/import]