A class that is ancestor of all moving objects in a game.
More...
#include <CMovingObject.h>
|
enum | EDirection {
DIRECTION_LEFT,
DIRECTION_UP,
DIRECTION_RIGHT,
DIRECTION_DOWN,
NO_DIRECTION
} |
| Enum of all directions that can moving object go in.
|
|
A class that is ancestor of all moving objects in a game.
◆ CMovingObject()
CMovingObject::CMovingObject |
( |
const CMap & |
map, |
|
|
const SCoordinates & |
location |
|
) |
| |
A constructor of the moving object.
- Parameters
-
[in] | map | map where the moving object is |
[in] | location | the location where the moving object will be after creation |
◆ getMoveVector()
Method returns move vector constructed from given arguments.
- Parameters
-
[in] | direction | direction in which the move vector will be constructed |
[in] | speed | determines how big will be the move vector |
- Returns
- the move vector is returned in form of coordinates ( vector goes from zero origin to these coordinates)
◆ getOpositeDirectionTo()
Method returns opposite direction to given direction.
- Parameters
-
[in] | directon | input direction |
- Returns
- opposite direction to the input direction
◆ getTileInDirection()
Method returns neighbour tile from map in given direction.
- Parameters
-
[in] | map | map where the moving object is |
[in] | direction | determines in which direction the tile will be |
- Returns
- the neighbour tile in the given direction
◆ innerGridMove()
float CMovingObject::innerGridMove |
( |
const SCoordinates & |
moveVector | ) |
|
|
protected |
Method that do the move in the space.
- Parameters
-
[in] | moveVector | vector that will move the object (x or y must be 0 in the vector) |
- Returns
- how much distance still wasnt used
◆ isOnIntersection()
bool CMovingObject::isOnIntersection |
( |
| ) |
const |
checks whether is object on intersection
- Returns
- true if is on intersection (coordinates with whole numbers, for example {32.0, 25.0})
◆ reset()
Method resets the moving object to initial state.
- Parameters
-
[in] | map | map where the moving object is |
[in] | coordinates | new location after the rest |
◆ location_
location of the moving object
The documentation for this class was generated from the following files: