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—working with forces, impulses, acceleration and speed

We are now going to use Farseer Physics Engine to add a gravitational force affecting the UFO. Also, we will add the possibility to apply a force to accelerate the UFO and to impulse it, updating its speed.

  1. Stay in the 3DInvadersSilverlight project.
  2. Open InvadersGame.cs.
  3. Add the following lines of code at the beginning (as we are going to use many Farseer's classes and interfaces):
    using FarseerGames.FarseerPhysics;
    using FarseerGames.FarseerPhysics.Collisions;
    using FarseerGames.FarseerPhysics.Dynamics;
    using FarseerGames.FarseerPhysics.Factories;
    using FarseerGames.FarseerPhysics.Mathematics;
    
  4. Add the following private variable in the public class InvadersGame : RealTimeGame

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