Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals   Related Pages  

CMovingGameObj Class Reference

Base class for all moving game objects. More...

#include <gameobj.h>

Inheritance diagram for CMovingGameObj:

CGameObj CVisibleBotInfo CVisibleBulletInfo CBotInfo CBulletInfo CBot

Public Member Functions

 CMovingGameObj (int aType)

virtual ~CMovingGameObj ()

float velocity ()
 Getter for the velocity.

Protected Member Functions

void move (float aTimeFactor)
 Moves object according to its velocity and direction.

void chkCollision (const char **aTileMap, CBotInfo **aBots, bool aCollisionWithObstacles)
 Checks collisions and calculates time factor for moving.

TPosition scanTileMap (const char **aSrcTileMap, float aAngle, CTileMap *aDstTileMap)
 Raycaster to scan visible tiles.

virtual void handleCollision (int aType)=0
 Collision handling.

Protected Attributes

float mVelocity
 Velocity of the moving game object.

Detailed Description

Base class for all moving game objects.

Includes speed and collision detection.

Constructor & Destructor Documentation

CMovingGameObj::CMovingGameObj int    aType


aType Type of the object.

Member Function Documentation

void CMovingGameObj::chkCollision const char **    aTileMap,
CBotInfo **    aBots,
bool    aCollisionWithObstacles

Checks collisions and calculates time factor for moving.

Time factor is 1.0, if no collisions are detected. In a case of collision both objects are handled using handleCollision().

aTileMap Tilemap to detect collisions.
aBots List of all bots.
aCollisionWithObstacles True to enable collisions with obstacles. Bots can collide with walls and obstacles, while bullets can collide only with walls.

void CMovingGameObj::move float    aTimeFactor [protected]

Moves object according to its velocity and direction.

aTimeFactor Time interval to move object.

TPosition CMovingGameObj::scanTileMap const char **    aSrcTileMap,
float    aAngle,
CTileMap *    aDstTileMap

Raycaster to scan visible tiles.

Can be used to check collisions with walls.

aSrcTileMap Full tilemap to read tiles for scanning.
aAngle Moving direction for casted ray.
aDstTileMap Tilemap to write visible tiles. NULL to disable vision scanning (with collision detection).
Position of the detected collision.

Field Documentation

float CMovingGameObj::mVelocity [protected]

Velocity of the moving game object.

Moving direction depends on the orientation of the object.

The documentation for this class was generated from the following file:
Generated on Mon Jun 9 22:02:26 2003 for Drunken Bot III by doxygen1.3-rc3