Pool End Game
Chapter 3 of Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Enumerations Pages
Public Member Functions | Friends | List of all members
CBallObject Class Reference

The ball object. More...

#include <BallObject.h>

Inheritance diagram for CBallObject:
CGameObject

Public Member Functions

 CBallObject (GameObjectType object, D3DXVECTOR2 position)
 Constructor.
 
void move ()
 Change position depending on time and velocity.
 
void DeliverImpulse (float angle, float magnitude)
 Deliver an impulse.
 
- Public Member Functions inherited from CGameObject
 CGameObject (GameObjectType objecttype)
 Constructor.
 

Friends

class CBallManager
 
class CObjectWorld
 
class CObjectManager
 

Additional Inherited Members

- Protected Attributes inherited from CGameObject
GameObjectType m_nObjectType
 Object type.
 
D3DXVECTOR2 m_vPosition
 Current position.
 
D3DXVECTOR2 m_vVelocity
 Current velocity.
 
int m_nLastMoveTime
 Last time moved.
 
BOOL m_bAtRest
 Whether object is at rest.
 
int m_nFrictionTime
 Timer for applying friction.
 

Detailed Description

The ball object.

Member Function Documentation

void CBallObject::DeliverImpulse ( float  angle,
float  magnitude 
)

Deliver an impulse.

Deliver an impulse to the object, given the angle and magnitude.

Parameters
angleAngle at which the impulse is to be applied.
magnitudeMagnitude of the impulse to apply.
void CBallObject::move ( )
virtual

Change position depending on time and velocity.

Move ball. Move the ball, apply collision and response with pockets and rails, playing the appropriate sound if necessary.

Reimplemented from CGameObject.