- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# Player Class Reference

`#include <Player.h>`

Inheritance diagram for Player:

List of all members.

## Public Member Functions
| Player (List *playerInfo, int x, int y)
void | control ()
void | update ()
void | shootSecondary ()
void | collide (Object *o)
virtual Object * | copy ()
void | addSecondary (std::string filename)
SDL_Rect | drawSecondaryAmmo (SDL_Rect raster)
void | die ()
virtual void | addHealth (int dHealth)
## Protected Attributes
int | _cDWait
int | _cDTime
Weapon * | _secondaryWeapon
## Static Protected Attributes
static const int | MAXHEALTH = 16

## Detailed Description

Definition at line 7 of file Player.h.

## Constructor & Destructor Documentation

Player::Player | ( | List * | playerInfo,
|  | int | x,
|  | int | y
| ) |

| Definition at line 15 of file Player.cpp. References Object::_depth, Object::_type, and PLAYER. Referenced by copy().

## Member Function Documentation

void Player::addHealth | ( | int | dHealth | ) | `[virtual]`

| Reimplemented from Person. Definition at line 191 of file Player.cpp. References Person::_health, Person::addHealth(), and MAXHEALTH.

void Player::addSecondary | ( | std::string | filename | ) |

| Definition at line 56 of file Player.cpp. References _secondaryWeapon, Weapon::addAmmo(), Weapon::getAmmo(), and Weapon::id(). Referenced by AddWeaponCommand::execute().

void Player::collide | ( | Object * | o | ) | `[virtual]`

| Reimplemented from Person. Definition at line 29 of file Player.cpp. References _cDTime, _cDWait, BOSS, Person::collide(), and Object::getType().

void Player::control | ( |  | ) | `[virtual]`

| Reimplemented from Object. Definition at line 107 of file Player.cpp. References Person::_crouching, Person::_xDirection, Control::altShoot1Key, Control::altShoot2Key, DOWN, Control::downKey, CommandManager::execute(), CommandManager::instance(), Control::jumpKey, LEFT, Control::leftKey, MIDDLE, RIGHT, Control::rightKey, CommandManager::saveRecording(), saveTimer, Control::shoot1Key, Control::shoot2Key, CommandManager::startRecording(), CommandManager::stopRecording(), UP, and Control::upKey.

Object * Player::copy | ( |  | ) | `[virtual]`

| Reimplemented from Person. Definition at line 44 of file Player.cpp. References Person::_primaryWeapon, Person::_punchWeapon, _secondaryWeapon, WeaponPunch::copy(), Weapon::copy(), and Player(). Referenced by Level::update().

void Player::die | ( |  | ) | `[virtual]`

| Schedules the calling object for deletion. Reimplemented from Person. Definition at line 38 of file Player.cpp. References Person::die(), Level::instance(), and Level::setScore(). Referenced by EndLevelCommand::execute(), and Level::update().

SDL_Rect Player::drawSecondaryAmmo | ( | SDL_Rect | raster | ) |

| Definition at line 80 of file Player.cpp. References _secondaryWeapon, and Weapon::drawAmmo().

void Player::shootSecondary | ( |  | ) |

| Definition at line 74 of file Player.cpp. References _secondaryWeapon, and Weapon::shoot(). Referenced by SecondaryShootCommand::execute().

void Player::update | ( |  | ) | `[virtual]`

| Reimplemented from Person. Definition at line 91 of file Player.cpp. References _secondaryWeapon, Weapon::getAmmo(), Weapon::update(), and Person::update().

## Member Data Documentation

int Player::_cDTime`[protected]`

| Definition at line 28 of file Player.h. Referenced by collide().

int Player::_cDWait`[protected]`

| Definition at line 27 of file Player.h. Referenced by collide().

Weapon* Player::_secondaryWeapon`[protected]`

| Definition at line 29 of file Player.h. Referenced by addSecondary(), copy(), drawSecondaryAmmo(), shootSecondary(), and update().

const int Player::MAXHEALTH = 16`[static, protected]`

| Definition at line 31 of file Player.h. Referenced by addHealth().

The documentation for this class was generated from the following files:

- C:/Documents and Settings/jegan/Desktop/projectX/Player.h
- C:/Documents and Settings/jegan/Desktop/projectX/Player.cpp