Box2D Cannon Game
Chapter 7 of Ian Parberry's "Introduction to Game Physics with Box2D"
|
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 |
The game object.
Game objects are responsible for remembering information about themselves, in particular, their representations in Render World and Physics World.
CGameObject::CGameObject | ( | GameObjectType | objecttype | ) |
Constructor.
Constructor for a game object.
objecttype | Object type. |
CGameObject::~CGameObject | ( | ) |
Destructor.
Destructor for a game object. It takes care of destroying the object's body in Physics World.
void CGameObject::SetPhysicsBody | ( | b2Body * | b | ) |
Set pointer to physics world body.
Set the physics body pointer (from Physics World) of the game object.
b | Pointer to the physics body. |