I'm working on a simple breakout game and I've problem with ball:addEventListener( "collision", removeBricks )
, it works fine until the ball hits two bricks at same time, than the up/down direction (vy
) switch twice, making the ball continue moving up or down.
How can do one by one addEventListener collision and disable multiple collides at once?
function removeBricks(event)
if event.other.isBrick == 1 then
vy = vy * (-1)
...
end
end