From 98ba22e7064db57316dfff1ae127feb3dceeb73e Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 31 Jul 2014 13:58:22 +0200 Subject: Initial commit --- docs/html/class_enemy_car.html | 480 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 480 insertions(+) create mode 100644 docs/html/class_enemy_car.html (limited to 'docs/html/class_enemy_car.html') diff --git a/docs/html/class_enemy_car.html b/docs/html/class_enemy_car.html new file mode 100644 index 0000000..b6720d9 --- /dev/null +++ b/docs/html/class_enemy_car.html @@ -0,0 +1,480 @@ + + + + +Rally X: EnemyCar Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
EnemyCar Class Reference
+
+
+ +

GameObject that chases the player around the maze. + More...

+ +

#include <EnemyCar.h>

+
+Inheritance diagram for EnemyCar:
+
+
+ + +Car +GameObject + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 EnemyCar (double x, double y)
 Creates an EnemyCar at the given coordinates.
void update (const Maze &maze, const list< PlayerCar > &players, const list< Rock > &rocks)
 Processes one frame's worth of activity for the object, called every frame.
void crash ()
 Function that is called when an EnemyCar crashes into a PlayerCar.
void blind ()
 Function that is called when an EnemyCar drives into a Smokescreen.

+Private Types

enum  States { BLINDED, +CHASING + }
 States that define how the EnemyCar's AI should behave. More...

+Private Member Functions

void checkFacing (const Maze &maze, double chasingX, double chasingY, const list< Rock > &rocks)
 Updates the direction that the EnemyCar is facing, if neccesary.
bool rockAtLocation (double x, double y, const list< Rock > &rocks)
 Iterates through a list of Rocks and determines if moving to a given position would result in a collision.

+Private Attributes

States _state
 The state that the object is currently in.
double _targetX
 The x coordinate that the EnemyCar is driving towards.
double _targetY
 The y coordinate that the EnemyCar is driving towards.
+

Detailed Description

+

GameObject that chases the player around the maze.

+

Attempts to collide with the player, causing the player to lose.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 21 of file EnemyCar.h.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum EnemyCar::States [private]
+
+
+ +

States that define how the EnemyCar's AI should behave.

+

This would need to be expanded to include more states in order to make the enemies appear smarter.

+
Enumerator:
+ + +
BLINDED  +

The EnemyCar can not see, and so does not move.

+
CHASING  +

The EnemyCar tries to drive to the block that the player is currently on.

+
+
+
+ +

Definition at line 61 of file EnemyCar.h.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
EnemyCar::EnemyCar (double x,
double y 
)
+
+
+ +

Creates an EnemyCar at the given coordinates.

+
Parameters:
+ + + +
[in]xThe x coordinate of the EnemyCar's initial position.
[in]yThe y coordinate of the EnemyCar's initial position.
+
+
+ +

Definition at line 3 of file EnemyCar.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void EnemyCar::blind ()
+
+
+ +

Function that is called when an EnemyCar drives into a Smokescreen.

+ +

Definition at line 100 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void EnemyCar::checkFacing (const Mazemaze,
double chasingX,
double chasingY,
const list< Rock > & rocks 
) [private]
+
+
+ +

Updates the direction that the EnemyCar is facing, if neccesary.

+

The facing is only changed once the current _targetX and _targetY are reached. After that, a facing is chosen that points into an empty block (no maze walls or rocks) that is closest to the chasing x and y using a straight line. This results in the enemy not always taking the shortest route, but it makes it possible to escape enemies. _targetX and _targetY are updated to one block in the new facing direction. The enemy may only turn around and head backwards if there is no other options, so once the enemy starts driving down narrow a path it will continue to the end of the path.

+
Parameters:
+ + + + + +
[in]mazeThe maze that confines the EnemyCar's movements.
[in]chasingXThe x coordinate that the EnemyCar is ultimately trying to reach.
[in]chasingYThe y coordinate that the EnemyCar is ultimately trying to reach.
[in]rocksThe Rocks that the EnemyCar needs to avoid.
+
+
+ +

Definition at line 26 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
void EnemyCar::crash ()
+
+
+ +

Function that is called when an EnemyCar crashes into a PlayerCar.

+ +

Definition at line 95 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool EnemyCar::rockAtLocation (double x,
double y,
const list< Rock > & rocks 
) [private]
+
+
+ +

Iterates through a list of Rocks and determines if moving to a given position would result in a collision.

+
Parameters:
+ + + + +
[in]xThe potential new x coordinate.
[in]yThe potential new y coordinate.
[in]rocksThe Rocks that are checked for a collision at x and y.
+
+
+ +

Definition at line 86 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void EnemyCar::update (const Mazemaze,
const list< PlayerCar > & players,
const list< Rock > & rocks 
)
+
+
+ +

Processes one frame's worth of activity for the object, called every frame.

+

Primarily adjusts the facing if neccesary and then moves using the inhereted move function.

+
Parameters:
+ + + + +
mazeThe maze that confines the EnemyCar's movements.
playersThe list of PlayerCars that the EnemyCar can chase.
rocksThe list of Rocks that need to be avoided.
+
+
+ +

Definition at line 11 of file EnemyCar.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
States EnemyCar::_state [private]
+
+
+ +

The state that the object is currently in.

+ +

Definition at line 66 of file EnemyCar.h.

+ +
+
+ +
+
+ + + + +
double EnemyCar::_targetX [private]
+
+
+ +

The x coordinate that the EnemyCar is driving towards.

+ +

Definition at line 67 of file EnemyCar.h.

+ +
+
+ +
+
+ + + + +
double EnemyCar::_targetY [private]
+
+
+ +

The y coordinate that the EnemyCar is driving towards.

+ +

Definition at line 68 of file EnemyCar.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + -- cgit v1.2.3