Rally X
ELEN3009 Project by Justin Wernick and David Schneider
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Car Class Reference

GameObject that moves through the maze and changes direction. More...

#include <Car.h>

Inheritance diagram for Car:
GameObject EnemyCar PlayerCar

List of all members.

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.

Detailed Description

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.

Author:
Justin Wernick
David Schneider

Definition at line 20 of file Car.h.


Constructor & Destructor Documentation

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.

Parameters:
[in]xx coordinate of initial position.
[in]yy coordinate of initial position.
[in]imageBitmap to be drawn on the screen to represent the car.
[in]facingDirection in which the Car is initially facing.

Definition at line 3 of file Car.cpp.


Member Function Documentation

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.

Parameters:
[in]mazeThe maze in which the Car is moving, confining its movements.

Definition at line 14 of file Car.cpp.

double Car::speed ( ) const

Function to access the current speed of the car.

Returns:
The current speed of the car, in pixels per update.

Definition at line 9 of file Car.cpp.


Member Data Documentation

const double Car::_baseSpeed = 0.1 [static, protected]

The speed that a Car moves at in normal conditions.

Definition at line 54 of file Car.h.

double Car::_speed [protected]

The current speed that the Car is moving at.

Definition at line 53 of file Car.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator