When detecting collisions in the usual manner:
1 2 3 4 5 6 7 8 | local function collision( ball, event ) print("collision"); --this often gets printed twice or more --award points return true; end ball.collision = collision; ball:addEventListener( "collision", ball ); |
Have you tried only counting collisions happening in a certain phase. Such as:
1 2 3 4 5 6 7 8 9 10 | local function collision( ball, event ) if event.phase == began then -- You could also use the "ended" phase print("collision"); end return true; end ball.collision = collision; ball:addEventListener( "collision", ball ); |
that seems to work. thanks.
You're welcome!
views:1423 update:2011/9/29 9:22:17