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—using chasing algorithms

Your project manager wants to test the results offered by many AI algorithms. He wants you to create an AI algorithm to make one UFO chase the other. However, the algorithm has to make the UFO wander randomly in the middle of the chase.

Now, we are going to add AI to the game in order to make one UFO pursue the other:

  1. Stay in the 3DInvadersSilverlight project.
  2. Open Ufo.cs.
  3. Add the following enum to define AI states for the Ufo's instances (after the namespace and before the class definition):
    public enum UfoAIState { // Wandering because the other character is too far away Wandering, // Chasing another character Chasing, // Evading another character Evading, // It is not necessary to chase or evade the other ...

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