- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# Person Class Reference

`#include <Person.h>`

Inheritance diagram for Person:

List of all members.

## Public Member Functions
| Person (List *personInfo, int x, int y)
| ~Person ()
void | draw ()
void | collide (Object *o)
virtual void | update ()
void | jump (xDirection xDir)
void | jumpReset ()
void | crouch ()
void | uncrouch ()
void | shoot ()
virtual void | setPos (int x, int y)
virtual Object * | copy ()
void | load (List *personInfo, bool fromConstructor=true)
void | setVelocity (int x, int y)
int | getHealth ()
virtual void | addHealth (int dHealth)
void | incrVelocity (int xVel, int yVel)
void | setXDirection (xDirection xDir)
int | getAccel ()
xDirection | getXDirection ()
yDirection | getYDirection ()
void | aim (yDirection direction)
bool | touchingAbove (int pels=1)
bool | touchingBelow (int pels=1)
bool | touchingLeft (int pels=1)
bool | touchingRight (int pels=1)
virtual bool | invincible ()
virtual void | setInvincible (bool inv)
virtual void | die ()
virtual void | live ()
## Protected Attributes
bool | _invincible
int | _xVelocity
int | _yVelocity
int | _maxXVel
int | _maxYVel
int | _maxFallRate
int | _previousX
int | _previousY
xDirection | _xDirection
xDirection | _prevXDirection
yDirection | _yDirection
State | _state
std::string | _dropItem
bool | _crouching
int | _health
int | _gravity
int | _accel
int | _airAccel
double | _groundDrag
double | _airDrag
int | _jumpTimer
int | _maxJumpTime
bool | _jumpReset
bool | _wallJumpReset
int | _wallFallTime
Weapon * | _primaryWeapon
WeaponPunch * | _punchWeapon
int | _punchTimer
ShowOneSprite * | _sprite

## Detailed Description

Definition at line 14 of file Person.h.

## Constructor & Destructor Documentation

Person::Person | ( | List * | personInfo,
|  | int | x,
|  | int | y
| ) |

| Definition at line 45 of file Person.cpp. References Object::_box, Object::_collidable, _previousX, _previousY, and load(). Referenced by copy().

Person::~Person | ( |  | ) |

| Definition at line 149 of file Person.cpp. References _primaryWeapon, and _punchWeapon.

## Member Function Documentation

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

| Reimplemented in Player. Definition at line 520 of file Person.cpp. References _health, _invincible, Object::_type, die(), ENEMY, CommandManager::execute(), CommandManager::instance(), and PLAYER. Referenced by Player::addHealth(), and AddHealthCommand::execute().

void Person::aim | ( | yDirection | direction | ) | `[inline]`

| Definition at line 53 of file Person.h. References _yDirection. Referenced by AimCommand::execute().

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

| Reimplemented from Object. Reimplemented in Player. Definition at line 171 of file Person.cpp. References Object::_box, _previousX, _previousY, Object::_type, _xVelocity, _yVelocity, DOOR, ENEMY, Object::getBox(), Object::getType(), glfuncs::intersectX(), glfuncs::intersectY(), PLAYER, TILE, Level::tileHeight, and touchingAbove(). Referenced by Player::collide().

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

| Reimplemented from Object. Reimplemented in Enemy, and Player. Definition at line 157 of file Person.cpp. References _primaryWeapon, Weapon::copy(), and Person().

void Person::crouch | ( |  | ) |

| Make the person crouch Definition at line 447 of file Person.cpp. References Object::_box, _crouching, _previousX, _previousY, _sprite, Sprite::setHeight(), and touchingBelow(). Referenced by CrouchCommand::execute().

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

| Schedules the calling object for deletion. Reimplemented in Enemy, and Player. Definition at line 478 of file Person.cpp. References Object::_box, Object::_collidable, _dropItem, Object::getBox(), Level::instance(), Object::loadObject(), Level::registerObject(), Level::scheduleDelete(), and Object::setPos(). Referenced by addHealth(), Player::die(), and Enemy::die().

void Person::draw | ( |  | ) | `[virtual]`

| Implements Object. Definition at line 208 of file Person.cpp. References Object::_box, _sprite, _state, _xDirection, CROUCHING, DEAD, ShowOneSprite::draw(), FALLING, JUMPING, PUNCHING, RUNNING, Sprite::setDirection(), ShowOneSprite::show(), STANDING, and WALLFALLING.

int Person::getAccel | ( |  | ) |

| Definition at line 348 of file Person.cpp. References _accel, _airAccel, and touchingBelow(). Referenced by MoveCommand::execute().

int Person::getHealth | ( |  | ) | `[inline]`

| Definition at line 37 of file Person.h. References _health. Referenced by Level::drawHUD().

xDirection Person::getXDirection | ( |  | ) | `[inline]`

| Definition at line 49 of file Person.h. References _xDirection. Referenced by WeaponPunch::shoot().

yDirection Person::getYDirection | ( |  | ) | `[inline]`

| Definition at line 50 of file Person.h. References _yDirection.

void Person::incrVelocity | ( | int | xVel,
|  | int | yVel
| ) |

| Definition at line 334 of file Person.cpp. References _maxFallRate, _maxXVel, _xVelocity, and _yVelocity. Referenced by MoveCommand::execute(), and update().

virtual bool Person::invincible | ( |  | ) | `[inline, virtual]`

| Definition at line 60 of file Person.h. References _invincible.

void Person::jump | ( | xDirection | xDir | ) |

| Definition at line 356 of file Person.cpp. References _crouching, _jumpReset, _jumpTimer, _maxJumpTime, _maxXVel, _maxYVel, _prevXDirection, _wallJumpReset, _xDirection, _xVelocity, _yVelocity, LEFT, RIGHT, touchingAbove(), touchingBelow(), touchingLeft(), and touchingRight(). Referenced by JumpCommand::execute().

void Person::jumpReset | ( |  | ) |

| Definition at line 421 of file Person.cpp. References _jumpReset, _jumpTimer, _maxJumpTime, _sprite, _wallJumpReset, and ShowOneSprite::reset(). Referenced by JumpResetCommand::execute().

void Person::live | ( |  | ) | `[virtual]`

| Definition at line 415 of file Person.cpp. References _invincible, _state, and STANDING.

void Person::load | ( | List * | personInfo,
|  | bool | fromConstructor = `true`
| ) | `[virtual]`

| Reimplemented from Object. Reimplemented in Enemy. Definition at line 83 of file Person.cpp. References _accel, _airAccel, _airDrag, Object::_box, _dropItem, _gravity, _groundDrag, _health, _maxFallRate, _maxJumpTime, _maxXVel, _maxYVel, _primaryWeapon, _punchWeapon, _sprite, Object::load(), and Sprite::loadSprite(). Referenced by Enemy::load(), and Person().

virtual void Person::setInvincible | ( | bool | inv | ) | `[inline, virtual]`

| Definition at line 61 of file Person.h. References _invincible.

void Person::setPos | ( | int | x,
|  | int | y
| ) | `[virtual]`

| Reimplemented from Object. Definition at line 164 of file Person.cpp. References _previousX, _previousY, and Object::setPos(). Referenced by WeaponPunch::shoot().

void Person::setVelocity | ( | int | x,
|  | int | y
| ) | `[inline]`

| Definition at line 35 of file Person.h. References _xVelocity, and _yVelocity. Referenced by StopPersonCommand::execute().

void Person::setXDirection | ( | xDirection | xDir | ) | `[inline]`

| Definition at line 46 of file Person.h. References _prevXDirection, and _xDirection. Referenced by TurnCommand::execute(), and MoveCommand::execute().

void Person::shoot | ( |  | ) |

| Definition at line 429 of file Person.cpp. References _crouching, _primaryWeapon, _punchTimer, _punchWeapon, _state, PUNCHING, WeaponPunch::shoot(), and Weapon::shoot(). Referenced by ShootCommand::execute().

bool Person::touchingAbove | ( | int | pels = `1` | ) |

| Definition at line 491 of file Person.cpp. References Object::_box, and CollisionHandler::ObjsColliding(). Referenced by collide(), jump(), and uncrouch().

bool Person::touchingBelow | ( | int | pels = `1` | ) |

| Definition at line 498 of file Person.cpp. References Object::_box, and CollisionHandler::ObjsColliding(). Referenced by crouch(), getAccel(), jump(), update(), and Enemy::update().

bool Person::touchingLeft | ( | int | pels = `1` | ) |

| Definition at line 505 of file Person.cpp. References Object::_box, and CollisionHandler::ObjsColliding(). Referenced by jump(), and update().

bool Person::touchingRight | ( | int | pels = `1` | ) |

| Definition at line 512 of file Person.cpp. References Object::_box, and CollisionHandler::ObjsColliding(). Referenced by jump(), and update().

void Person::uncrouch | ( |  | ) |

| Uncrouches the person Definition at line 462 of file Person.cpp. References Object::_box, _crouching, _previousX, _previousY, _sprite, Sprite::setHeight(), and touchingAbove(). Referenced by CrouchCommand::execute().

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

| Reimplemented from Object. Reimplemented in Enemy, and Player. Definition at line 246 of file Person.cpp. References _airDrag, Object::_box, _crouching, _gravity, _groundDrag, _previousX, _previousY, _primaryWeapon, _punchTimer, _punchWeapon, _sprite, _state, _wallFallTime, _xVelocity, _yVelocity, CollisionHandler::checkCollision(), CROUCHING, DEAD, FALLING, Screen::FRAMERATE, incrVelocity(), CollisionHandler::instance(), JUMPING, PUNCHING, RUNNING, STANDING, touchingBelow(), touchingLeft(), touchingRight(), Weapon::update(), ShowOneSprite::update(), and WALLFALLING. Referenced by Player::update(), and Enemy::update().

## Member Data Documentation

int Person::_accel`[protected]`

| Definition at line 101 of file Person.h. Referenced by getAccel(), and load().

int Person::_airAccel`[protected]`

| Definition at line 102 of file Person.h. Referenced by getAccel(), and load().

double Person::_airDrag`[protected]`

| Definition at line 104 of file Person.h. Referenced by load(), and update().

bool Person::_crouching`[protected]`

| Definition at line 86 of file Person.h. Referenced by Player::control(), crouch(), jump(), shoot(), uncrouch(), and update().

std::string Person::_dropItem`[protected]`

| Definition at line 84 of file Person.h. Referenced by die(), and load().

int Person::_gravity`[protected]`

| Definition at line 100 of file Person.h. Referenced by load(), and update().

double Person::_groundDrag`[protected]`

| Definition at line 103 of file Person.h. Referenced by load(), and update().

int Person::_health`[protected]`

| Definition at line 98 of file Person.h. Referenced by Player::addHealth(), addHealth(), getHealth(), and load().

bool Person::_invincible`[protected]`

| Definition at line 68 of file Person.h. Referenced by addHealth(), Enemy::die(), invincible(), live(), and setInvincible().

bool Person::_jumpReset`[protected]`

| Definition at line 108 of file Person.h. Referenced by jump(), and jumpReset().

int Person::_jumpTimer`[protected]`

| Definition at line 106 of file Person.h. Referenced by jump(), and jumpReset().

int Person::_maxFallRate`[protected]`

| Definition at line 74 of file Person.h. Referenced by incrVelocity(), and load().

int Person::_maxJumpTime`[protected]`

| Definition at line 107 of file Person.h. Referenced by jump(), jumpReset(), and load().

int Person::_maxXVel`[protected]`

| Definition at line 72 of file Person.h. Referenced by incrVelocity(), jump(), and load().

int Person::_maxYVel`[protected]`

| Definition at line 73 of file Person.h. Referenced by jump(), and load().

int Person::_previousX`[protected]`

| Definition at line 76 of file Person.h. Referenced by collide(), crouch(), Person(), setPos(), uncrouch(), and update().

int Person::_previousY`[protected]`

| Definition at line 77 of file Person.h. Referenced by collide(), crouch(), Person(), setPos(), uncrouch(), and update().

xDirection Person::_prevXDirection`[protected]`

| Definition at line 80 of file Person.h. Referenced by jump(), and setXDirection().

Weapon* Person::_primaryWeapon`[protected]`

| Definition at line 114 of file Person.h. Referenced by Player::copy(), copy(), Enemy::copy(), load(), shoot(), update(), and ~Person().

int Person::_punchTimer`[protected]`

| Definition at line 116 of file Person.h. Referenced by shoot(), and update().

WeaponPunch* Person::_punchWeapon`[protected]`

| Definition at line 115 of file Person.h. Referenced by Player::copy(), load(), shoot(), update(), and ~Person().

ShowOneSprite* Person::_sprite`[protected]`

| Definition at line 118 of file Person.h. Referenced by crouch(), draw(), jumpReset(), load(), uncrouch(), and update().

State Person::_state`[protected]`

| Definition at line 82 of file Person.h. Referenced by Enemy::die(), draw(), live(), shoot(), and update().

int Person::_wallFallTime`[protected]`

| Definition at line 111 of file Person.h. Referenced by update().

bool Person::_wallJumpReset`[protected]`

| Definition at line 109 of file Person.h. Referenced by jump(), and jumpReset().

xDirection Person::_xDirection`[protected]`

| Definition at line 79 of file Person.h. Referenced by Player::control(), draw(), getXDirection(), jump(), and setXDirection().

int Person::_xVelocity`[protected]`

| Definition at line 70 of file Person.h. Referenced by collide(), Enemy::die(), incrVelocity(), jump(), setVelocity(), and update().

yDirection Person::_yDirection`[protected]`

| Definition at line 81 of file Person.h. Referenced by aim(), and getYDirection().

int Person::_yVelocity`[protected]`

| Definition at line 71 of file Person.h. Referenced by collide(), Enemy::die(), incrVelocity(), jump(), setVelocity(), and update().

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

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