Advice on ball behaviour in Breakout. The ball sometimes gets stuck in a boring loop

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robster
:warning: Old Version Published before Godot 3 was released.

I’m making Breakout. It’s going well. The base game is nearly done and I’m about to add juice. Just a few bugs to squash first.

I have an issue with the ball behaviour and I’m keen on opinions.

Sometimes the ball will hit a brick and start moving almost purely horizontal. This can go on for as many as 30-80 bounces before it makes its way back to the bat. It’s REALLY annoying and dull.

What would be the best way to go about correcting this? Would I somehow check for angle, and if it hits X angle for Y bounces, force a new angle?

Does anyone have any other ideas? I don’t want to make it overly fake, but it can’t just sit in the boring horizontal X bounce loop for too long else the player will quit (and rightfully so).

I guess it’s about game design, not technical issue.

volzhs | 2017-04-26 14:06

Definitely game design related. I posted it in the Projects area due to this. I assume that’s ok?

Robster | 2017-04-27 12:02

:bust_in_silhouette: Reply From: eons

I guess you have some problem with your physics logic.

I think Arkanoid solved this by adding an angle after some bounces (but I may be confusing with another breakout).

Maybe the most subtle hack could be not allowing “PI/2” angles, even adding or substracting 0.0005 degrees may help.

If your ball has an angular speed (that can’t be zero), it can be used to calculate the bounce too.


Don’t worry about faking things, you are looking for a good gameplay experience and that means faking lot of things ^^;

Thank you. I played with a few ideas based on your feedback. In the end I ended up simply giving the ball .5 gravity. So it makes a beautiful and graceful fall as it starts hitting the wall too many times. I give the bat an extra 20% punch / power and it makes up for the sluggish feel it was getting from the gravity. It’s near perfect now, well, good enough to not notice. Thanks again, it was really helpful.

Robster | 2017-04-27 12:01