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_player_car.html | 435 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 435 insertions(+) create mode 100644 docs/html/class_player_car.html (limited to 'docs/html/class_player_car.html') diff --git a/docs/html/class_player_car.html b/docs/html/class_player_car.html new file mode 100644 index 0000000..09bf834 --- /dev/null +++ b/docs/html/class_player_car.html @@ -0,0 +1,435 @@ + + + + +Rally X: PlayerCar Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
PlayerCar Class Reference
+
+
+ +

A GameObject that is controlled by the player. + More...

+ +

#include <PlayerCar.h>

+
+Inheritance diagram for PlayerCar:
+
+
+ + +Car +GameObject + +
+ +

List of all members.

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

+Public Member Functions

 PlayerCar (double x, double y, Maze::Direction facing=Maze::UP)
 Creates a PlayerCar at the given location facing in the given direction.
void update (const Maze &maze, list< Smokescreen > &currentSmoke)
 Processes one frame's worth of activity for the object, called every frame.
void makeSmoke (list< Smokescreen > &currentSmoke)
 Creates a Smokescreen one block behind the player if the action is viable.
void gotCheckpoint ()
 Function that is called when the PlayerCar collides with a Checkpoint.
void crash ()
 Function that is called when the PlayerCar collides with an EnemyCar.
double petrol () const
 Function to allow access to the amount of petrol that the PlayerCar still has.

+Private Attributes

KeyboardHandler _input
 Object that handles all interaction with the player.
double _petrol
 The amount of petrol that the PlayerCar still has.

+Static Private Attributes

static const double PETROL_USE_RATE = 0.0007
 The amount of petrol used every frame.
static const double PETROL_USE_SMOKESCREEN = 0.05
 The amount of petrol used to create a Smokescreen.
static const double PETROL_FROM_CHECKPOINT = 0.2
 The amount of petrol gained from collecting a Checkpoint.
+

Detailed Description

+

A GameObject that is controlled by the player.

+

Contains a KeyboardHandler to accept user input.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 23 of file PlayerCar.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
PlayerCar::PlayerCar (double x,
double y,
Maze::Direction facing = Maze::UP 
)
+
+
+ +

Creates a PlayerCar at the given location facing in the given direction.

+

In the current form of the level files, there is no way to distinguish the direction that the player is facing, so the default of UP is used. However, the ability to pass in a facing is useful in the unit tests.

+
Parameters:
+ + + + +
[in]xThe x coordinate of the object's initial position.
[in]yThe y coordinate of the object's initial position.
[in]facingThe direction that the object is initially facing.
+
+
+ +

Definition at line 3 of file PlayerCar.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void PlayerCar::crash ()
+
+
+ +

Function that is called when the PlayerCar collides with an EnemyCar.

+ +

Definition at line 73 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
void PlayerCar::gotCheckpoint ()
+
+
+ +

Function that is called when the PlayerCar collides with a Checkpoint.

+

Increases the amount of petrol by PETROL_FROM_CHECKPOINT.

+ +

Definition at line 78 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void PlayerCar::makeSmoke (list< Smokescreen > & currentSmoke)
+
+
+ +

Creates a Smokescreen one block behind the player if the action is viable.

+

The action is viable if the object has more than PETROL_USE_SMOKESCREEN petrol. Further, the position must not overlap with existing Smokescreens. This allows the player to hold down the Smokescreen button without creating a new Smokescreen every frame. Creating a Smokescreen decreases the petrol by PETROL_USE_SMOKESCREEN.

+
Parameters:
+ + +
[in,out]currentSmokeThe list of Smokescreens being drawn, that the new Smokescreens will be added to the back of.
+
+
+ +

Definition at line 28 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
double PlayerCar::petrol () const
+
+
+ +

Function to allow access to the amount of petrol that the PlayerCar still has.

+ +

Definition at line 84 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PlayerCar::update (const Mazemaze,
list< Smokescreen > & currentSmoke 
)
+
+
+ +

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

+

The Keyboard handler is called for the user's input. Based on this, the direction can be changed, and a Smokescreen can be created and added to the list of already existing Smokescreens. The PlayerCar is then moved. Petrol is decreased by PETROL_USE_RATE on every update.

+
Parameters:
+ + + +
[in]mazeThe Maze that confines the PlayerCar's movement.
[in,out]currentSmokeThe list of Smokescreens being drawn, that the new Smokescreens will be added to the back of.
+
+
+ +

Definition at line 10 of file PlayerCar.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
KeyboardHandler PlayerCar::_input [private]
+
+
+ +

Object that handles all interaction with the player.

+ +

Definition at line 84 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
double PlayerCar::_petrol [private]
+
+
+ +

The amount of petrol that the PlayerCar still has.

+

Measured as a fraction, with 1 being a full tank and 0 being empty. When the petrol reaches 0, it is kept at zero and the PlayerCar's speed is halved.

+ +

Definition at line 92 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_FROM_CHECKPOINT = 0.2 [static, private]
+
+
+ +

The amount of petrol gained from collecting a Checkpoint.

+ +

Definition at line 96 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_USE_RATE = 0.0007 [static, private]
+
+
+ +

The amount of petrol used every frame.

+ +

Definition at line 94 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_USE_SMOKESCREEN = 0.05 [static, private]
+
+
+ +

The amount of petrol used to create a Smokescreen.

+ +

Definition at line 95 of file PlayerCar.h.

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