Pong Collision Help in C# w/ XNA

Posted by Ramses Brown on Game Development See other posts from Game Development or by Ramses Brown
Published on 2011-01-25T01:45:46Z Indexed on 2012/06/01 4:50 UTC
Read the original article Hit count: 357

Filed under:
|
|

Edit: My goal is to have it function like this:

Ball hits 1st Quarter = rebounds higher (aka Y++) Ball hits 2nd Quarter = rebounds higher (using random value) Ball hits 3rd Quarter = rebounds lower (using random value) Ball hits 4th Quarter = rebounds lower (aka Y--)

I'm currently using Rectangle Collision for my collision detection, and it's worked. Now I wish to expand it.

Instead of it simply detecting whether or not the paddle/ball intersect, I want to make it so that it can determine what section of the paddle gets hit. I wanted it in 4 parts, with each having a different reaction to impact.

My first thought is to base it on the Ball's Y position compared to the Paddle's Y position. But since I want it in 4 parts, I don't know how to do that.

So it's essentially be

if (ball.Y > Paddle.Y)
{
PaddleSection1 == true;
}

Except modified so that instead of being top half/bottom half, it's 1st Quarter, etc.

© Game Development or respective owner

Related posts about XNA

Related posts about c#