Pool End Game
Chapter 3 of Ian Parberry's "Introduction to Game Physics with Box2D"
|
The object world. More...
#include <objectworld.h>
Public Member Functions | |
void | create (GameObjectType t, D3DXVECTOR2 position) |
Create new object. | |
void | clear () |
Clear objects. | |
void | move () |
Move objects. | |
void | draw () |
void | ResetImpulseVector () |
Reset the Impulse Vector. | |
void | AdjustImpulseVector (float amount) |
Adjust the Impulse Vector. | |
void | AdjustCueBall (float amount) |
Move cue-ball up or down. | |
void | shoot () |
Shoot the cue ball. | |
BOOL | BallDown () |
Is a ball down in a pocket? | |
BOOL | CueBallDown () |
Is the cue ball down in a pocket? | |
BOOL | AllBallsStopped () |
Have all balls stopped moving? | |
The object world.
void CObjectWorld::AdjustCueBall | ( | float | amount | ) |
Move cue-ball up or down.
Adjust the cue ball up or down.
amount | Amount to move by. |
void CObjectWorld::AdjustImpulseVector | ( | float | amount | ) |
Adjust the Impulse Vector.
Adjust the cue ball up or down.
amount | Amount to move by. |
BOOL CObjectWorld::AllBallsStopped | ( | ) |
Have all balls stopped moving?
Check whether both the cue-ball and the 8-ball have stopped moving.
BOOL CObjectWorld::BallDown | ( | ) |
Is a ball down in a pocket?
Check whether the cue-ball or the 8-ball is in a pocket.
void CObjectWorld::create | ( | GameObjectType | t, |
D3DXVECTOR2 | position | ||
) |
Create new object.
Create an object in the Object World.
t | Object type. |
position | Initial position. |
BOOL CObjectWorld::CueBallDown | ( | ) |
Is the cue ball down in a pocket?
Check whether the cue-ball is in a pocket.
void CObjectWorld::draw | ( | ) |
Draw everything in the Object World. Draw the impulse vector, then the game objects.
void CObjectWorld::ResetImpulseVector | ( | ) |
Reset the Impulse Vector.
Make the impulse vector point from the center of the cue-ball object to the center of the 8-ball object.