GEJM  1.0.0.0
a 2D platformer made by students
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Controller Class Reference

#include <Controller.h>

Inheritance diagram for Controller:
PlayerController

Public Member Functions

 Controller (Creature *creature, double maxSpeed=1.0)
 
virtual ~Controller ()
 
virtual void control ()
 
CreaturegetCreature ()
 
ControllerState getControllerState ()
 

Protected Member Functions

void goLeft ()
 
void goRight ()
 
void stopGoing ()
 
Controlleroperator= (Controller const &)=delete
 

Protected Attributes

Creaturecreature
 
ControllerState controllerState
 
double const maxSpeed
 

Detailed Description

Controller is a base class that can control a Creature. Default implementation move in one direction then change it after collision.

Constructor & Destructor Documentation

Controller::Controller ( Creature creature,
double  maxSpeed = 1.0 
)

The default constructor with Creature possesion.

Parameters
creatureassociation of Creature object
maxSpeedan absolute value of a maximum horizontal velocity that Controller should set
See also
Creature
maxSpeed

Controller implementation The default constructor with Creature possesion.

Parameters
creatureassociation of Creature object.
maxSpeedan absolute value of a maximum horizontal velocity that Controller should set.
See also
Creature
maxSpeed
Controller::~Controller ( )
virtual

The default destructor.

Member Function Documentation

void Controller::control ( )
virtual

A virtual implementation of how to control associated Creature.

See also
Creature
goLeft()
goRight()
stopGoing()
Returns
void

Reimplemented in PlayerController.

ControllerState Controller::getControllerState ( )

Get current state of controller

Returns
ControllerState
Creature * Controller::getCreature ( )

Get associated Creature.

See also
Creature
Returns
Creature* a pointer to associated Creature
void Controller::goLeft ( )
protected

Make associated Creature go left.

See also
Creature
Returns
void
void Controller::goRight ( )
protected

Make associated Creature go right.

See also
Creature
Returns
void
Controller& Controller::operator= ( Controller const &  )
protecteddelete

Assignment operator is deleted because Controller has constant variable.

void Controller::stopGoing ( )
protected

Make associated Creature stop going.

See also
Creature
Returns
void

Member Data Documentation

ControllerState Controller::controllerState
protected

a protected ControllerState variable

See also
ControllerState
Creature* Controller::creature
protected

a protected pointer to associated Creature

double const Controller::maxSpeed
protected

an absolute value of a maximum horizontal velocity that Controller should set


The documentation for this class was generated from the following files: