Rally X
ELEN3009 Project by Justin Wernick and David Schneider
|
GameObject that moves through the maze and changes direction. More...
#include <Car.h>
Public Member Functions | |
Car (double x, double y, BitmapStore::Image image, Maze::Direction facing) | |
Creates a Car at the given position, with the given image, facing in the given direction. | |
double | speed () const |
Function to access the current speed of the car. | |
Protected Member Functions | |
void | move (const Maze &maze) |
Moves the car by its current speed in the direction of its facing. | |
Protected Attributes | |
double | _speed |
The current speed that the Car is moving at. | |
Static Protected Attributes | |
static const double | _baseSpeed = 0.1 |
The speed that a Car moves at in normal conditions. |
GameObject that moves through the maze and changes direction.
Should not be instantiated directly, but rather instantiated through one of the subclasses, PlayerCar or EnemyCar.
Car::Car | ( | double | x, |
double | y, | ||
BitmapStore::Image | image, | ||
Maze::Direction | facing | ||
) |
Creates a Car at the given position, with the given image, facing in the given direction.
[in] | x | x coordinate of initial position. |
[in] | y | y coordinate of initial position. |
[in] | image | Bitmap to be drawn on the screen to represent the car. |
[in] | facing | Direction in which the Car is initially facing. |
void Car::move | ( | const Maze & | maze | ) | [protected] |
Moves the car by its current speed in the direction of its facing.
Only moves along the x or y axis, and snaps to the grid in the other direction. Does not allow movement through solid parts of the maze.
[in] | maze | The maze in which the Car is moving, confining its movements. |
double Car::speed | ( | ) | const |
const double Car::_baseSpeed = 0.1 [static, protected] |
double Car::_speed [protected] |