CObject Class Reference

Generic object base class (i.e. for powerups, enemies, etc.). More...

#include <class.objectmanager.hh>

Inheritance diagram for CObject:

Inheritance graph
[legend]
Collaboration diagram for CObject:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CObject (CSprite *pSprite)
virtual ~CObject ()
bool Frame (Uint8 *keystate, Uint32 iDeltaTime)
 Do everything that happens between frames.
virtual bool Interact (CObject *pObj)
 Interaction trigger.
bool Logic (Uint8 *keystate, Uint32 iDeltaTime)
 Updates object logic (the default animations/collisions etc).
bool CollisionHor (int x, int y, int *iTileY)
 Collision detection.
bool CollisionVer (int x, int y, int *iTileX)
 Collision detection.
bool RemoveHP (int hp)
 Remove health points.
void Remove ()
 Remove the object from the object manager.
void RemoveAndFree ()
 Remove the object from the object manager and free it's memory.
virtual void SetAnimStand ()
 Set stand animation.
virtual void SetAnimMove ()
 Set move animation.
virtual void SetAnimJump ()
 Set jump animation.
virtual void SetAnimFall ()
 Set fall animation.
virtual bool UpdateMovement (Uint8 *keystate, Uint32 iDeltaTime, int iCollisionStatus)
 Update object movement.
int Weapon_GetAmmo ()
 Get weapon's ammo amount.
bool Weapon_AddAmmo (int amount)
 Add ammo to the weapon.
virtual CPlayerCastToPlayer ()
 Cast to player class.
virtual CEnemyCastToEnemy ()
 Cast to enemy class.
virtual CWeaponCastToWeapon ()
 Cast to weapon class.
virtual CBulletCastToBullet ()
 Cast to bullet class.

Public Attributes

bool mbDead
int iLastCollisionStatus
 Status of the last collision.
CSpritempSprite
CVector2D mvVel
 Velocity.
CWeaponmpWeapon
Uint32 miRemoveHP_Timeout
int miHP
 Health points.
bool mbJumpLock
 Whether jumping is locked or not.

Private Member Functions

 CObject ()


Detailed Description

Generic object base class (i.e. for powerups, enemies, etc.).

Constructor & Destructor Documentation

CObject::CObject (  )  [private]

CObject::CObject ( CSprite pSprite  ) 

CObject::~CObject (  )  [virtual]


Member Function Documentation

bool CObject::Frame ( Uint8 *  keystate,
Uint32  iDeltaTime 
)

Do everything that happens between frames.

For example: things like logic, animations and collisions.

Remarks:
Returns 1 if the object removed itself. Returns 0 if the object didn't remove itself.
This is done to prevent errors such as accessing an object while it was already removed from the object list.

bool CObject::Interact ( CObject pObj  )  [virtual]

Interaction trigger.

Remarks:
Returns 1 if the object removed itself. Returns 0 if the object didn't remove itself.
This is done to prevent errors such as accessing an object while it was already removed from the object list.

Reimplemented in CEnemy, CPlayer, CPowerUp, and CBullet.

bool CObject::Logic ( Uint8 *  keystate,
Uint32  iDeltaTime 
)

Updates object logic (the default animations/collisions etc).

bool CObject::CollisionHor ( int  x,
int  y,
int *  iTileY 
)

Collision detection.

bool CObject::CollisionVer ( int  x,
int  y,
int *  iTileX 
)

Collision detection.

bool CObject::RemoveHP ( int  hp  ) 

Remove health points.

Remarks:
Returns 1 if the object removed itself, because no health points were left. Returns 0 if the object didn't remove itself, meaning it still has health points left.

void CObject::Remove (  ) 

Remove the object from the object manager.

void CObject::RemoveAndFree (  ) 

Remove the object from the object manager and free it's memory.

void CObject::SetAnimStand (  )  [virtual]

Set stand animation.

Reimplemented in CPlayer.

void CObject::SetAnimMove (  )  [virtual]

Set move animation.

Reimplemented in CPlayer.

void CObject::SetAnimJump (  )  [virtual]

Set jump animation.

Reimplemented in CPlayer.

void CObject::SetAnimFall (  )  [virtual]

Set fall animation.

Reimplemented in CPlayer.

bool CObject::UpdateMovement ( Uint8 *  keystate,
Uint32  iDeltaTime,
int  iCollisionStatus 
) [virtual]

Update object movement.

Reimplemented in CEnemy, and CBullet.

int CObject::Weapon_GetAmmo (  ) 

Get weapon's ammo amount.

bool CObject::Weapon_AddAmmo ( int  amount  ) 

Add ammo to the weapon.

Remarks:
Returns 1 when adding ammo succeeded. Returns 0 when adding ammo failed. If this happens, it indicates that the object didn't carry a weapon.

CPlayer * CObject::CastToPlayer (  )  [virtual]

Cast to player class.

Reimplemented in CPlayer.

CEnemy * CObject::CastToEnemy (  )  [virtual]

Cast to enemy class.

Reimplemented in CEnemy.

CWeapon * CObject::CastToWeapon (  )  [virtual]

Cast to weapon class.

Reimplemented in CWeapon.

CBullet * CObject::CastToBullet (  )  [virtual]

Cast to bullet class.

Reimplemented in CBullet.


Member Data Documentation

Status of the last collision.

Velocity.

Health points.

Whether jumping is locked or not.


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

Generated on Fri Feb 22 09:36:53 2008 for Mega Maryo by  doxygen 1.5.5