Collision with half of a semi-circle

Posted by heitortsergent on Game Development See other posts from Game Development or by heitortsergent
Published on 2011-11-25T15:06:11Z Indexed on 2011/11/28 18:55 UTC
Read the original article Hit count: 258

Filed under:
|
|
|

I am trying to port a game I made using Flash/AS3, to the Windows Phone using C#/XNA 4.0. You can see it here: http://goo.gl/gzFiE

In the flash version I used a pixel-perfect collision between meteors (it's a rectangle, and usually rotated) that spawn outside the screen, and move towards the center, and a shield in the center of the screen(which is half of a semi-circle, also rotated by the player), which made the meteor bounce back in the opposite direction it came from, when they collided.

My goal now is to make the meteors bounce in different angles, depending on the position it collides with the shield (much like Pong, hitting the borders causes a change in the ball's angle).

So, these are the 3 options I thought of:

  1. Pixel-perfect collision (Microsoft has a sample) , but then I wouldn't know how to change the meteor angle after the collision

  2. 3 BoundingCircle's to represent the half semi-circle shield, but then I would have to somehow move them as I rotate the shield.

  3. Farseer Physics. I could make a shape composed of 3 lines, and use that as the collision object for the shield.

Is there any other way besides those? Which would be the best way to do it(it's aimed towards mobile devices, so pixel-perfect is probably not a good choice)? Most of the time there's always a easier/better way than what we think of...

© Game Development or respective owner

Related posts about XNA

Related posts about c#