I am developing my first mobile application with Corona SDK. This is the rule of my game: I have this ball and when it collides with the end of the maze, it will show a dialog box that you passed the level. I tried adding a collision listener at the finish line, but it doesn’t work. The code I used DOES show the dialog box, but it happens that the dialog box popups when the ball collides with EVERY border I have (not the finish line).
Here is the code I have so far(part of it):
[code]
local ball = display.newImage(“ball3.png”, _W, _H);
ball:setReferencePoint(display.CenterReferencePoint);
ball.x = 350; ball.y = 100;
local borderend = display.newRect( 65, 55, 20, 100 )
borderend:setFillColor( 0, 0, 0, 0) – make invisible
physics.addBody( borderend, “static”, borderBodyElement )
local function onLocalCollision( self, event )
if ( event.phase == “began” ) then
local alert = native.showAlert( “You Passed The level!”, “”, { “Level2”, “Main Menu” }, onBackComplete )
end
end
ball.collision = onLocalCollision
ball:addEventListener( “collision”, ball)
borderend.collision = onLocalCollision
borderend:addEventListener( “collision”, borderend )
–Can anyone help me show the dialog box when the ball collides with the finish line but not every border I have? [import]uid: 44110 topic_id: 15551 reply_id: 315551[/import]

[import]uid: 52491 topic_id: 15551 reply_id: 57469[/import]