I've nearly finished my first pong clone and only have a few more things I'd like to do with it. One of them is to make it have better collision.
Currently I'm just checking whether there is a collision and reversing the x-velocity, but I want to have it so that different things can affect what happens to the ball such as where on the paddle it hits and which direction the paddle is moving in.
I'm thinking maybe changing the yVelocity depending on how far away from the center of the paddle the ball hits and also adding a portion of the paddle's y-velocity to the balls.
But I'd appreciate some ideas from people on other ways I could do this.
Pong Collision
Moderator: PC Supremacists
- thejahooli
- Chaos Rift Junior
- Posts: 265
- Joined: Fri Feb 20, 2009 7:45 pm
- Location: London, England
Pong Collision
I'll make your software hardware.
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Pong Collision
Why not add a twist to it? not just bouncing off the board but also making the velocity a random number every time it collides. You see what Im thinking?thejahooli wrote:I've nearly finished my first pong clone and only have a few more things I'd like to do with it. One of them is to make it have better collision.
Currently I'm just checking whether there is a collision and reversing the x-velocity, but I want to have it so that different things can affect what happens to the ball such as where on the paddle it hits and which direction the paddle is moving in.
I'm thinking maybe changing the yVelocity depending on how far away from the center of the paddle the ball hits and also adding a portion of the paddle's y-velocity to the balls.
But I'd appreciate some ideas from people on other ways I could do this.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Pong Collision
IIRC, the original was "change the angle based on where on the paddle you hit" but obviously it would be better if it was "change the angle based on how fast the paddle was moving when it hit".
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.