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

Entity Class Reference

A game object that is drawn and can affect gameplay. More...

#include <Entity.h>

Inheritance diagram for Entity:

Drawable Bomb Character Explosion Powerup HomingBomb ThrownBomb List of all members.

Public Methods

 Entity ()
 Default constructor.

 Entity (const Rect &initPos, int initDir)
 Constructor.

virtual ~Entity ()
 Destructor.

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

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;.

virtual bool update (float dt)=0
 Update the game logic.

virtual void draw (const Point &anchor)=0
 Draw this entity on the screen, given the anchor point on the screen, which is defined as the center of the Entity's contact with the ground.

virtual const RectgetPosition () const
 Get the current position on the map.

int getDirection () const
 Get the direction this Entity is currently facing.

void reverseDirection ()
 Reverses the direction the entity is facing.


Protected Attributes

Rect pos
 The current position on the map.

Animation anim
 The animation responsible for drawing.

int direction
 The direction this entity is currently facing.

float cachedHeight
 Height value for use by children who may want to cache their heights.


Detailed Description

A game object that is drawn and can affect gameplay.


Constructor & Destructor Documentation

Entity::Entity  
 

Default constructor.

Authors: Jim Clase, Jonathan Hilliker, Jason Winnebeck

Entity::Entity const Rect   initPos,
int    initDir
 

Constructor.

Parameters:
initPos  the initial position
initDir  the initial direction

Entity::~Entity   [virtual]
 

Destructor.


Member Function Documentation

bool Entity::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 in Character.

void Entity::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 in Bomb, Character, and ThrownBomb.

virtual void Entity::draw const Point   anchor [pure virtual]
 

Draw this entity on the screen, given the anchor point on the screen, which is defined as the center of the Entity's contact with the ground.

Implements Drawable.

Implemented in Bomb, Character, Explosion, HomingBomb, Powerup, and ThrownBomb.

int Entity::getDirection  
 

Get the direction this Entity is currently facing.

Returns:
the direction this Entity is currently facing

const Rect & Entity::getPosition   [virtual]
 

Get the current position on the map.

Returns:
the current position on the map

Implements Drawable.

void Entity::reverseDirection  
 

Reverses the direction the entity is facing.

virtual bool Entity::update float    dt [pure virtual]
 

Update the game logic.

Parameters:
dt  the amount of time since the last frame
Returns:
true if this entity should be removed from the game

Implemented in Bomb, Character, Explosion, HomingBomb, Powerup, and ThrownBomb.


Member Data Documentation

Animation Entity::anim [protected]
 

The animation responsible for drawing.

float Entity::cachedHeight [protected]
 

Height value for use by children who may want to cache their heights.

int Entity::direction [protected]
 

The direction this entity is currently facing.

Rect Entity::pos [protected]
 

The current position on the map.


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