This project is read-only.

Rendering the Dwarf

  • Now that we have created our FSM blueprint, the dwarf can be rendered in his bind pose by adding a FiniteStateMachine member variable and adding this line to LoadGraphicsContent:
        fsm = new DwarfFSM(this, animator);

  • Before going on, I would consider changing the lighting for the dwarf. It is a bit bland. You can do this in the same manner you would change the lighting for BasicEffect, except that the dwarf is using BasicPaletteEffect.

Rendering the Ground

  • We will render the ground in the same way as the Microsoft XNA mesh example. I'll just post the code here without explanation, since it is explained in the XNA tutorial.
  • Add these member variables to your game:
        Model ground;
        Matrix[] bones;
  • Add this to LoadGraphicsContent:
        ground = content.Load<Model>("flat");
        bones = new Matrix[ground.Bones.Count];
  • Add this to Update:
        foreach (ModelMesh mesh in ground.Meshes)
            foreach (BasicEffect effect in mesh.Effects)
                effect.World = bones[mesh.ParentBone.Index]*Matrix.CreateScale(5,1,5);
                effect.View = fsm.View;
                effect.Projection = fsm.Projection;
  • Add this to Draw:
        foreach (ModelMesh mesh in ground.Meshes)

Last edited Feb 12, 2007 at 4:34 AM by dastle, version 7


No comments yet.