Pong Collision

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

Pong Collision

Post by thejahooli »

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.
I'll make your software hardware.
User avatar
davidthefat
Chaos Rift Maniac
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

Post by davidthefat »

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.
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?
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Pong Collision

Post by MarauderIIC »

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.
Post Reply