Now, we are going to create a specialized subclass of Actor
(Balder.Core.Runtime.Actor
) to define a meteor. Each meteor will be a 3D character.
1. Stay in the
3DInvadersSilverlight
project.2. Create a new class—
Meteor
(a subclass ofActor
)—using the following declaration:public class Ufo : Actor
3. Add the following lines of code at the beginning (as we are going to use many classes and interfaces from Balder and Farseer Physics Engine):
using Balder.Core; using Balder.Core.Geometries; using Balder.Core.Math; using Balder.Core.Runtime; using FarseerGames.FarseerPhysics; using FarseerGames.FarseerPhysics.Collisions; using FarseerGames.FarseerPhysics.Dynamics; using FarseerGames.FarseerPhysics.Factories; using FarseerGames.FarseerPhysics.Mathematics;
4. Add the following
protected
variables to hold references for theRealTimeGame
and theScene
instances:protected RealTimeGame _game; protected Scene _scene;
5. Add the following
protected
...