How do I release ball from self-caused bounce loop?

From the Asset Store
Bounce the ball and try to keep it bouncing and prevent it from falling down for as long as you can.
  • Hey all,

    the title isn't a great way to describe my situation. I'm making a Breakout-style game right now, and occasionally the ball will be bouncing from wall to wall, but then will get stuck in an almost perfectly horizontal bounce loop. Sometimes, it will be bouncing continuously on a slight angle. I just didn't know if there was a way to tell the game to launch the ball in a random direction if it gets caught in that loop? If anyone has any questions, I'll gladly answer them. Thanks guys!

  • In my opinion, I will check if the angle between 179 & 181 or -1 & 1, I will add a number to change it bouncing angle.

  • We can try to fix the bounce so it never ends up going horizontal. The original breakout only changed the angle the ball moved when it hit the paddle, otherwise the bounces were perfect.

    Here's a test of some ideas.

    dropbox.com/s/fubwui5edgzjep1/bounce_constrain.capx

    It has three on collision events. Only one should be enabled at a time.

    The first is probably what you're already doing. It uses the bounce action and sometimes the ball starts going very horizontal if a corner is hit. The issue case.

    The second one tries to fix the bounce angle to be perfectly mirrored or flipped from before the collision. It works mostly but when a corner is hit the ball can start going in the opposite direction.

    The third takes it a step further. Instead of fixing the bounce it will calculate the bounce itself. To do that it first backs the ball up until it's no longer in the wall and then uses overlap at offset to check if it's next to a horizontal or vertical wall.

  • Perfect. Thanks guys, I'll give these a go tomorrow!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • From my past experience with pong, I found "perfect" bounces happened because of the limited resolution of the collision box (octagonal). You can tweak it a bit manually rotating the collision box points slightly so that they are not perfectly in line with any 90 degree angle.

    I had meant to try making an ball out of several separate objects to increase the resolution of the circle but never got around to trying it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)