XNA Game Programming—Player
|Visual C# Tutorials|
|.NET Framework Tutorials|
|© 2008 Lobão, et. al.|
In this section you'll create the
Player class, which has the player's attributes and logic.
Player class extends and adds some functionalities to the
Figure 12-7 shows the marine model used as the game player.
Player class, you first store the type of player you're creating, because you
might have some different types of players in the game. You also store the player's
weapon, because it is updated according to the player. For example, the player's weapon
is always positioned in the player’s right hand.
// Player type UnitTypes.PlayerType playerType; // Player weapon PlayerWeapon playerWeapon;
Next, declare two attributes to store and control the transformations made over the waist bone of the player's animated model. You can use this transformation to rotate the player's torso around his waist:
// Waist bone float rotateWaistBone; float rotateWaistBoneVelocity;