简体   繁体   中英

C# XNA 2D Collision Detection with push back?

有谁知道有任何很好的教程将碰撞检测和推回效果结合在一起,当两个对象发生碰撞时,它们会以各自的方式推回去?

You'll want to reverse the direction when a collision occurs, this can be done via:

Direction.X *= -1;

And then assigning:

Position += Direction;

A simple google search will provide plenty of results on this.

I really enjoyed Asteroid Belt Assault (you'll have to sign up or do a trial). Asteroids bounce off each other in a very realistic way.

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