How do I create a ball bounce by angle effect?

0 favourites
  • 8 posts
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • Hey all,

    Suppose I have a moving box/platform in which a ball hits. I'd like the get the "ball bounce" behavior, where the ball moves more to the right if hit on the right side of the platform, or left if hit on the left part of the platform (or balance itself if it was moving right initially).

    I've seen the breakout tutorial here: https://www.scirra.com/tutorials/313/cl ... kout-video, but I'm looking for a physics behavior method of doing this, not a bullet one. Just like bouncing a ball on the head.

    How do I start calculating such a behavior?

    Thanks! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Either use bullet behaviour with gravity in it (simplest) or use physics behaviour.

    You can use math as well with "on collision" and dynamic angle.

  • funkyy, I've tried using physics with apply impulse on it, the problem with physics, is that hitting corners makes it go crazy, which I don't want. I only want the nehavior to apply when jumping on the the platform, and not the corners.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi funkyy it looks like trueicecold is looking for the physics behaviour to me.

  • yeah, I'm looking for that "curve" when the ball reaches the top and starts to descend, that can't be achieved with bullet (at least I don't think it can). In addition, putting gravity on the bullet, means it'll gradually lose bounciness, which I don't want.

  • You could try this:

    Don't give the paddle the physics behavior.

    on ball collides with the paddle then

    apply impulse up on the ball

    and

    apply a horizontal impulse depending on where on the paddle was hit.

    Like this

    (ball.x-paddle.x)*k

    where k is a number to adjust the strength of the impulse.

    Then all that's left is to choose numbers that give acceptable results.

  • Thanks a lot R0J0hound!! Adding impulse Y at -2 did the trick, as well as the impulse X with the calculation

    Also, removing the physics from the player (paddle) fixed the cornering issue

    Thanks a lot!

  • I love you R0J0hound, I was stucked for a entire day with this in CC

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