¿Cómo funciona la física para juegos de estilo pelota y paleta como Breakout y Pong?

I have the following game:

enter image description here

I have the rectangle collisions ready with the ball and with the tiles. but my problem is when the ball hits the tiles and the bat, what angle should the ball bounce at? How do I determine that?

preguntado el 27 de agosto de 11 a las 18:08

This isn't explicitly an answer to the question, but check out Farseer (farseerphysics.codeplex.com/SourceControl/list/changesets) for whatever physics calculations you may need. There's material about it here on StackOverflow and a lot more on the XNA forums. -

3 Respuestas

You should read up on physics, specifically Reflexión. There are lots of tutorials on Breakout style physics.

Respondido 27 ago 11, 23:08

It's not that difficult, if the ball hits a vertical obstacle simply invert its x velocity, if it hits a horizontal obstacle invert its y velocity.

Respondido 28 ago 11, 00:08

There is actually a built in method in the XNA Vector2 class just for this. Check out the Vector2.Reflect method.

Respondido 28 ago 11, 06:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.