Finish Flag

Ok, so i’ve only been using Corona for 3 days but I actually know a lot about it already.

I’m making an app where you get a square to the “finish flag” but that is my issue.

[lua]local function finishLevel( self, event )
if ( event.phase == “began” ) then
transition.to ( winner, { time=1000, alpha=1 } )
end
end

player.collision = finishLevel
player:addEventListener( “collision”, player )

finish.collision = finishLevel
finish:addEventListener( “collision”, finish )[/lua]

^Thats the code with issues. “Player” is the square. “finish” is the finish flag. Player is a draggable physics body and finish is a static physics body. “winner” is a text item that will fade on the screen and say: “You Win!”. The issue is that the square(player) will activate the “finishLevel” function when it collides with ANY physics body, not just the “finish” flag. What am I doing wrong? [import]uid: 28246 topic_id: 5676 reply_id: 305676[/import]

nvm… i realized that all i had to do was remove the listener from the player because the only item that needs to be activated is the “finish” so now as soon as it gets hit, it works.

[lua]local function finishLevel( self, event )
if ( event.phase == “began” ) then
transition.to ( winner, { time=1000, alpha=1 } )
end
end

finish.collision = finishLevel
finish:addEventListener( “collision”, finish )[/lua] [import]uid: 28246 topic_id: 5676 reply_id: 19454[/import]