Game Development Reference
In-Depth Information
The CDudeCollection is just as bland. It contains, as its member variable, a
vector containing CDude objects.
typedef std::vector < CDude > DUDE_LIST;
DUDE_LIST mlDudes; // List of Dudes in the game
We fill this vector with our Dudes when the constructor for CDudeCollection
calls InitDudes() which, in turn, calls InitOneDude() .
void CDudeCollection::InitDudes()
{
InitOneDude( BAD_DUDE, “Baddie�,
100, 180, 50, WEAPON_SHOTGUN );
InitOneDude( EVIL_DUDE, “Evilmeister�,
120, 200, 150, WEAPON_MACHINEGUN );
InitOneDude( ARCH_DUDE, “Boss Man�,
150, 150, 110, WEAPON_ROCKETS );
}
void CDudeCollection::InitOneDude( DUDE_TYPE Type,
char* Name,
USHORT Health,
USHORT Location,
USHORT DistToGoal,
WEAPON_TYPE Weapon )
{
CWeapon* pWeapon = mpWeaponCollection->GetWeaponPointer( Weapon );
CDude NewDude ( Type, Name, Health, Location, DistToGoal, pWeapon
);
mlDudes.push_back( NewDude );
}
Search WWH ::




Custom Search