O'Reilly logo

3D Game Development with Microsoft Silverlight 3 Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—detecting collisions between 2D characters

Now, we are going to add a very simple collision detection capability to the sprites.

Tip

This is not a precise collision detection algorithm. We are going to use a very simple technique to give some life to the game. However, we will improve our collision detection algorithms later in the following chapters. Our current focus is on a good object-oriented design for the sprites and on the modification of the game loop.

We want the aliens to show a different color when they collide with the ship. We want to see the changes necessary to add some logic to the game. We will do that by following these steps:

  1. Stay in the SilverlightInvaders2DVector project.
  2. Open the code for the superclass SpriteWrapper ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required