Brick Breaker (Breakout) Collision Problem

I’m creating a simple Breakout game and the collision of the Ball to other objects are sometimes incorrect.

When the Ball collides to the Block, it’s supposed to subtract one to its variable Health, and when it reaches 0, the Block will be deleted. When I tested it, sometimes it works and sometimes isn’t. My mask collision in all objects are accurate so I don’t know why sometimes it works and sometimes it doesn’t. Hope someone will help me about this issue. Thanks in advance!

1 Like

When you say sometimes it doesn’t work, do you mean that the health isn’t being always being decreased? If so, it could be because you’ve got a ball & block collision in which you bounce the ball off from the block, and then 2 events later you have a ball and block collision where you decrease the health. I’m wondering if the bounce occasionally separates the two objects enough so there’s no collision for the next test.

Try swapping the block collision and ball collision sections round, so you do the health reduction first and then the bounce off - it may fix it.

1 Like

Thank you! It works!