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

#include <Object.h>

Inheritance diagram for Object:
SolidObject Coin Creature Trigger MonsterCreature PlayerCreature

Public Member Functions

 Object (double x=0.0, double y=0.0, double width=1.0, double height=1.0)
 
virtual ~Object ()
 
virtual void savePrevious ()
 
void destroy ()
 
double getY () const
 
double getX () const
 
double getWidth () const
 
double getHeight () const
 
double getPrevX () const
 
double getPrevY () const
 
bool getDestroyed () const
 

Protected Attributes

double x
 
double y
 
double width
 
double height
 
double prevX
 
double prevY
 
bool destroyed
 

Detailed Description

Object is a base class for all game objects.

Constructor & Destructor Documentation

Object::Object ( double  x = 0.0,
double  y = 0.0,
double  width = 1.0,
double  height = 1.0 
)

The default constructor of Object.

Parameters
xX position of Object. Defaults to 0.0
yY position of Object. Defaults to 0.0
widthwidth of Object. Defaults to 1.0
heightheight of Object. Defaults to 1.0

Object implementation The default constructor of Object.

Parameters
xX position of Object. Defaults to 0.0
yY position of Object. Defaults to 0.0
widthwidth of Object. Defaults to 1.0
heightheight of Object. Defaults to 1.0
Object::~Object ( )
virtual

The default destructor.

Member Function Documentation

void Object::destroy ( )

Destroy object by seeting it's destroyed value to true. If object is destroyed, it shouldn't be used.

Returns
void
bool Object::getDestroyed ( ) const

Check if object is destroyed.

Returns
bool
double Object::getHeight ( ) const

Get objects height.

Returns
double
double Object::getPrevX ( ) const

Get previous X position.

Returns
double
double Object::getPrevY ( ) const

Get previous Y position.

Returns
double
double Object::getWidth ( ) const

Get objects width.

Returns
double
double Object::getX ( ) const

Get X position.

Returns
double
double Object::getY ( ) const

Get Y position.

Returns
double
void Object::savePrevious ( )
virtual

Virtual function that changes members that hold information about previous step to hold current state of Object.

Returns
void

Reimplemented in Creature.

Member Data Documentation

bool Object::destroyed
protected

Is object destroyed.

double Object::height
protected

Height of Object.

double Object::prevX
protected

Previous X position of Object.

double Object::prevY
protected

Previous Y position of Object.

double Object::width
protected

Width of Object.

double Object::x
protected

X position of Object.

double Object::y
protected

Y position of Object.


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