Box2D Cannon Game
Chapter 7 of Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Enumerations Friends Pages
Public Member Functions | Protected Attributes | Friends | List of all members
CGameObject Class Reference

The game object. More...

#include <Object.h>

Public Member Functions

 CGameObject (GameObjectType objecttype)
 Constructor.
 
 ~CGameObject ()
 Destructor.
 
void SetPhysicsBody (b2Body *b)
 Set pointer to physics world body.
 
void MakeSound ()
 Make the appropriate sounds.
 

Protected Attributes

GameObjectType m_nObjectType
 Object type.
 
b2Body * m_pBody
 Physics World body.
 
b2Vec2 m_b2vOldV
 Old velocity vector.
 

Friends

class CObjectManager
 
class CHeadsUpDisplay
 
class CObjectWorld
 
class CRenderWorld
 

Detailed Description

The game object.

Game objects are responsible for remembering information about themselves, in particular, their representations in Render World and Physics World.

Constructor & Destructor Documentation

CGameObject::CGameObject ( GameObjectType  objecttype)

Constructor.

Constructor for a game object.

Parameters
objecttypeObject type.
CGameObject::~CGameObject ( )

Destructor.

Destructor for a game object. It takes care of destroying the object's body in Physics World.

Member Function Documentation

void CGameObject::SetPhysicsBody ( b2Body *  b)

Set pointer to physics world body.

Set the physics body pointer (from Physics World) of the game object.

Parameters
bPointer to the physics body.