简体   繁体   中英

How do physics work for ball and paddle style games like Breakout and Pong?

I have the following game:

在此处输入图片说明

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?

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

如果球碰到垂直障碍物,只需将其x速度反转即可,如果球碰到水平障碍物,则可将y速度反转即可。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM