Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Character Class Reference

Represents a player or computer controller entity that can be moved on the screen and throw bombs. More...

#include <Character.h>

Inheritance diagram for Character:

Entity GameDXListener Drawable List of all members.

Public Methods

 Character ()
 Default constructor.

 Character (const Rect &initPos, int initDir, int wins)
 Constructor.

virtual ~Character ()
 Destructor.

bool affectMe (const CharacterProps &modprops)
 Applies the affects of the given character properties by adding each property to the character's current properties.

void affectMe (Virus *v)
 Attaches a virus to the character.

VirusgetVirus () const
 Returns the virus currently affecting this player or NULL if there isn't one.

void chargeThrow (float dt)
 Cause the character to start charging to throw a bomb.

void throwBomb ()
 Cause the character to throw a bomb.

void move (int dir, float dt)
 Moves the character on the map the given direction.

void noMove (float dt)
 If the move method is not called, this method should be called, when no move is made.

void draw (const Point &anchor)
 Draws the character.

bool update (float dt)
 Update the character's logic and animation.

void resetProps ()
 Sets the character's properties to the game default.

void stopAnimation ()
 Stops this character's animation.

bool isCharging () const
 Returns true if the chracter is charging up to throw a bomb.

void homingBomb ()
 Lays a homing bomb if the character has any available.

void setEnemy (const Character *c)
 Sets the character homing bombs will target.

void decBombCounter ()
 Called by ThrownBomb when the bomb explodes.

void decHitPoints ()
 Removes one hitpoint from the character.

void drawHUD (const Point &anchor)
 Draws a HUD for this player starting at the specified anchor.

virtual float getHeight () const
 Returns the current height.

void moveBack ()
 Moves the character back to its previous position.

virtual void doCollision (Entity *otherEntity)
 Handles the collision between 2 entities by finding what type of entities they are and then handling the different types of collisions;.

bool isDead () const
 Returns true if the character has died.

CharacterProps getProps () const
 Returns this character's props.

void setShrink (bool shrink)
 Shrinks or unshrinks the character.

virtual bool checkCollision (const Entity *otherEntity)
 Returns true if this entity is colliding with the given entity.

virtual void OnLostDevice ()
 Event called when device is lost.

virtual void OnResetDevice ()
 Event called when device is reset.


Static Public Methods

void initVars (ConfigFile &f)
 Initializes and static variables for Character from the ConfigFile.


Detailed Description

Represents a player or computer controller entity that can be moved on the screen and throw bombs.


Constructor & Destructor Documentation

Character::Character  
 

Default constructor.

Character::Character const Rect   initPos,
int    initDir,
int    wins
 

Constructor.

Parameters:
initPos  the initial position of the character on the map
initDir  the initial direction
wins  number of times this character has won

Character::~Character   [virtual]
 

Destructor.


Member Function Documentation

void Character::affectMe Virus   v
 

Attaches a virus to the character.

Parameters:
v  a virus

bool Character::affectMe const CharacterProps   modprops
 

Applies the affects of the given character properties by adding each property to the character's current properties.

Returns true if the properties were applied. If after the application any of the properties goes above the limit, false is returned to indicate that the properties were not applied.

Parameters:
modprops  the props used to modify the current props
Returns:
true if the properties were applied

void Character::chargeThrow float    dt
 

Cause the character to start charging to throw a bomb.

Parameters:
dt  the amount of time since the last frame

bool Character::checkCollision const Entity   otherEntity [virtual]
 

Returns true if this entity is colliding with the given entity.

Parameters:
otherEntity  the entity to check collision with
Returns:
true if there is a collision

Reimplemented from Entity.

void Character::decBombCounter  
 

Called by ThrownBomb when the bomb explodes.

Subtracts from the bomb counter so the player can lay more bombs.

void Character::decHitPoints  
 

Removes one hitpoint from the character.

void Character::doCollision Entity   otherEntity [virtual]
 

Handles the collision between 2 entities by finding what type of entities they are and then handling the different types of collisions;.

Parameters:
otherEntity  the entity to check collision with

Reimplemented from Entity.

void Character::draw const Point   anchor [virtual]
 

Draws the character.

The anchor is the center of the player's feet.

Implements Entity.

void Character::drawHUD const Point   anchor
 

Draws a HUD for this player starting at the specified anchor.

float Character::getHeight   [virtual]
 

Returns the current height.

Returns:
the current height

Reimplemented from Drawable.

CharacterProps Character::getProps  
 

Returns this character's props.

Returns:
this charcter's props

Virus * Character::getVirus  
 

Returns the virus currently affecting this player or NULL if there isn't one.

Returns:
virus currently affecting this player

void Character::homingBomb  
 

Lays a homing bomb if the character has any available.

void Character::initVars ConfigFile   f [static]
 

Initializes and static variables for Character from the ConfigFile.

bool Character::isCharging  
 

Returns true if the chracter is charging up to throw a bomb.

Returns:
true if the chracter is charging up to throw a bomb

bool Character::isDead  
 

Returns true if the character has died.

Returns:
true if the character has died

void Character::move int    dir,
float    dt
 

Moves the character on the map the given direction.

Parameters:
dir  the direction to move
dt  the amount of time since the last frame

void Character::moveBack  
 

Moves the character back to its previous position.

void Character::noMove float    dt
 

If the move method is not called, this method should be called, when no move is made.

For each logical update of the Character, either move or noMove should be called. Calling both or neither is not allowed.

Parameters:
dt  the amount of time since the last frame

void Character::OnLostDevice   [virtual]
 

Event called when device is lost.

Implements GameDXListener.

void Character::OnResetDevice   [virtual]
 

Event called when device is reset.

Implements GameDXListener.

void Character::resetProps  
 

Sets the character's properties to the game default.

void Character::setEnemy const Character *    c
 

Sets the character homing bombs will target.

Parameters:
c  the character homing bombs will target

void Character::setShrink bool    shrink
 

Shrinks or unshrinks the character.

If the flag is true, then the character will be shrunk, otherwise it will be restored to normal size.

Parameters:
shrink  if true, character will shrink

void Character::stopAnimation  
 

Stops this character's animation.

void Character::throwBomb  
 

Cause the character to throw a bomb.

bool Character::update float    dt [virtual]
 

Update the character's logic and animation.

Parameters:
dt  the amount of time since the last frame
Returns:
true if the character has died

Implements Entity.


The documentation for this class was generated from the following files:
Generated on Tue Mar 4 02:29:26 2003 for SuperIsoBomb by doxygen1.2.18