> > |
%META:TOPICINFO{author="BrianYoung" date="1099625160" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="ProjectThree"}%
List here the files we have, and what functions are within them. To keep things consistent, let's have all files in pairs, with foo.h having delarations and foo.cpp having definitions, no exceptions. Enclose any .h file with
#ifndef FOO_DEFINED
#define FOO_DEFINED 1
// Contents of file
#endif // FOO_DEFINED
I know it'll be hard to remember, but if we can keep this page updated it'll make our lives easier. -- BrianYoung - 04 Nov 2004
globals:
- constants
-
int GRID_RES - how many sections each dimension of the world is split into
-
float WORLD_SIZE - how big the world is; in consequence, each grid square is WORLD_SIZE/GRID_RES on a side
-
int PLAYER_MAX_HEALTH - health the player starts with
-
main() and all its cousins
- define a
GridLoc struct for holding x, y pairs of ints, and passing the pairs around easily
geometry:
- Same as for the golf game, to have the Tuple class. Can stand to be switched out for whatever coordinate system would work with the Windows API and whatever graphics framework we end up in - Mac?
tankworld:
- the TankWorld? class, written as a singleton
- public functions:
-
static TankWorld?* instance() - singleton accessor
-
void changeEnemyGrid() - move an enemy from one grid to another
- private functions:
- Constructor, copy, assignment
- data:
-
list<Enemy*>[GRID_RES][GRID_RES]; _enemy_grids - hold all enemies, filed by the grids they're in. I use list instead of vector, because in almost every time we use it we'll be cycling through every enemy in a grid, either checking collisions, or moving, or whatever.
-
static TankWorld?* theOneTankWorld - singleton pointer
player:
- the Player class, written as a singleton
- public functions:
-
static Player* instance() - singleton accessor
-
Tuple position() - return the player's position in the world
-
int score(int points) - add to the player's score and return it
- private functions:
- Constructor, copy, assignment
- data:
-
Tuple _position - where the player is
-
Tuple _heading - which way the player is facing
-
int _health - how many more hits the player can take
-
int _score - points accumulated
-
static Player* theOnePlayer - singleton pointer
basicenemy:
- the abstract Enemy class, which is actually anything in the world you can shoot
- public functions:
-
void draw() - draw to the current buffer; pure virtual function
-
void move() - update the enemy's position; pure virtual function
-
bool hit(int points) - do damage; return true if destroyed
- private functions:
-
bool checkGrid() - ensure the enemy is still stored in the proper grid; move it if not
- data:
-
Tuple _position - enemy's position in the world
-
int _hitpoints - number of hitpoints remaining; -1 represents invulnerability
-
int _pointvalue - how much a kill is worth; can be negative for terrain
-
GridLoc _inGrid - which grid square we're int
|