i have made almost all my game, but there is one problem, i need help finding a code to work for this
[code]
local ball = {}
local breakpoint = 0
local board = {}
local joint = {}
local function onCollision( event )
if ( event.phase == “began” ) then
print( "began: " … event.object1.ball … " & " … event.object2.board )
breakpoint = breakpoint + 1
elseif ( event.phase == “ended” ) then
print( "ended: " … event.object1.ball … " & " … event.object2.board )
breakpoint = breakpoint - 1
end
if breakpoint >= 7 then
joint:removeSelf()
end
end
for j = 1,38 do
board[j] = display.newImage( “board.png” )
board[j].x = 12 + (j*24)
board[j].y = 150
board[j].xScale = 1
board[j].yScale = 2.0
board[j].myIndex = j
board[j]:addEventListener( “postCollision”, breakJoint )
physics.addBody( board[j], { density=0.8, friction=0.3, bounce=0.3 } )
board[j].angularDamping = 5000
board[j].linearDamping = 0.7
if (j > 1) then
prevLink = board[j-1]
else
prevLink = pole1
end
joint[j] = physics.newJoint( “pivot”, prevLink, board[j], 12+(j*24), 150 )
end
joint[#joint + 1] = physics.newJoint( “pivot”, board[38], pole2, 12+(39*24), 150 )
local ball = display.newImage( “rock.png” )
ball.x = 100 + math.random( 800 ); ball.y = -40
physics.addBody( ball, { density=2.0, friction=0.6, bounce=0.2, radius=33 } )
ball.angularVelocity = math.random(600) - 300
ball:addEventListener( “touch”, removeBody )
timer.performWithDelay( 100, ball, 15 ) [import]uid: 35609 topic_id: 6323 reply_id: 306323[/import]