Get Pong ball to bounce correctly off sides

0 favourites
  • 6 posts
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.
  • Im a beginner here, trying to remake pong. I'm having trouble getting the "ball"(which is a square sprite unless someone can help me with that too) to bounch off the paddles correctly like the do in the game. Also to bounce correctly of the top and bottom walls, but get destroyed when the left/right walls. Right now it just crashes into the wall and stops

  • Hey sbakht, welcome to the forums!

    How are you making the ball move? The simplest way for something like this is to assign it the Bullet behavior. That behavior has a setting on the property bar on the left called "bounce off solids?", which if you set to yes will give you what you're looking for. All you have to do after that is assign the paddles and the top/bottom walls the Solid behavior. Leave the left/right walls without it so the ball won't bounce off of those.

    Lemme know if you need more of an explanation, or an example file to show you what I mean.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ya i had it as bullet with bounce off solids on. It will just bounce on a straight path back and forth if not set initially at an angle. If set at an angle. it follows the same path no matter how you hit it. It just seems to move differently in the real game depending on how fast you move the paddle and in what direction

    For the walls, I just have a black picture as background. How would you set a specific side to solid. I could make some invisible block and make that solid...

    I think an example might help.

  • Hello sbakht

    Here is a pong game I made a while back:


    If your using the free version of C2 I don't know if you will be able to open it because I think I used 5 layers. If you cant just let me know, and I will try to mod it for you.

    This is not the only way to make a pong game but it is the easiest way I could find to with C2.

    I didn't comment the event sheet because I'm lazy, and it is pretty small. So if you have any questions about it just ask.

    This pong game comes with a AI (Artificial Intelligence). You can adjust the AI speed to make it easier, or harder to play by looking for were it says "lerp(Paddle_AI.Y, Puck.Y,0.05)", and changing the speed "0.05" to a higher or lower number. You can also adjust the ball speed, and acceleration in the layout properties window.

    Just look through the events sheet to see how you can set the ball to start at random angles to give your game a more real feel.

    I hope this helps.

  • Hello,

    have you tried to change the collision-polygon of the paddle, in this version it is just a box... give it some angels or cut the corners, than you get more control over the ball.

    Look here for an example

    Enjoy coding...


  • Thanks all, got it working.

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