#ifndef FOO_DEFINED #define FOO_DEFINED 1 // Contents of file #endif // FOO_DEFINEDI 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:
int GRID_RES - how many sections each dimension of the world is split into
int 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()
GridLoc struct for holding x, y pairs of ints, and passing the pairs around easily
gridFromPos(Tuple position) function to translate absolute coordinates into a grid location
static TankWorld?* instance() - singleton accessor
void timeStep() - advance the world one time step
unsigned whenIsNow() - return the current time step
float zAt(float x, float y) - find the height of the terrain at a point
void changeEnemyGrid() - move an enemy from one grid to another
float _terrain[WORLD_SIZE][WORLD_SIZE] - hold the world height map
list<Bullet*> _bullets - hold all bullets in the world
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
unsigned _step - how many steps the world has made
bool _isPaused - pause state of the world
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
Tuple _position - where the player is
float _heading - which way the player is driving
float _aiming - which way the player is shooting
int _health - how many more hits the player can take
int _score - points accumulated
static Player* theOnePlayer - singleton pointer
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
bool checkGrid() - ensure the enemy is still stored in the proper grid; move it if not
Tuple _position - enemy's position in the world
float _size - radius for hit detection
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
void move() - update position
void setMotion(float _speed, float _turnRate) - set motion characteristics
void setDam(int direct, int splash, float size) - set damage characteristics
Tuple _position - current position
float _speed - bullet's speed
float _turnRate - max turning rate, for homing weapons
unsigned born - when it was created, for determining death
float _heading - which way the bullet is going
Enemy* _target - for homing weapons
bool _isHoming - behaviour flag
bool _isPlayers - friend/foe flag
int _directDam - damage on direct hit
int _splashDam - damage on hit nearby
float _splashSize - range of nearby damage
| Topic FilesAndClasses . { Edit | Attach | Ref-By | Printable | Diffs | r1.3 | > | r1.2 | > | r1.1 | More } |
|
Revision r1.3 - 07 Nov 2004 - 22:24 GMT - BrianYoung Parents: WebHome > ProjectThree |
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding TWiki? Send feedback. |