Game Engine 2D Platformer
|
Represents an interactable entity in the game that includes Main Character, NPC, Tiles , and etc. More...
#include <GameEntity.hpp>
Public Member Functions | |
GameEntity (entityType eType) | |
Constructor of GameEntity. More... | |
~GameEntity () | |
Destructor of GameEntity. More... | |
void | StartUp (Vector2D position, Vector2D velocity, int width, int height) |
Initializes attributes for the GameEntity object. More... | |
void | ShutDown () |
Destrotys and free attributes of the GameEntity Class. More... | |
void | Update () |
Updates the position of the game entity. More... | |
void | Render () |
Renders the object on screen for the GameEntity Class. More... | |
SDL_Rect * | GetRectangle () |
Returns the Rectangle for GameEntity. More... | |
SDL_Event | GetEvent () |
Returns the Event for GameEntity. More... | |
int | GetWidth () |
Returns the Width of GameEntity. More... | |
int | GetHeight () |
Returns the Height of GameEntity. More... | |
void | AddComponent (std::shared_ptr< Component > component) |
Adds different components to the GameEntity. More... | |
void | SetEvent (SDL_Event &e) |
Sets the SDL_Event for GameEntity class. More... | |
void | SetManager (EntityManager *entityManager) |
Sets EntityManager for GameEntity. More... | |
void | Reset () |
Resets the GameEntity. More... | |
Public Attributes | |
Vector2D | position |
Vector2D | velocity |
SDL_RendererFlip | flip = SDL_FLIP_NONE |
SDL_Rect | rect |
SDL_Rect | src |
SDL_Rect | dest |
SDL_Texture * | m_texture |
bool | win = false |
bool | lose = false |
int | lives = 3 |
int | score = 0 |
bool | eatSound = false |
bool | deathSound = false |
bool | collectItemSound = false |
bool | jumpSound = false |
bool | cameraFlag = false |
int | xPosTile = 0 |
std::vector< int > | collectablesAvailable |
int | arrayPos = 0 |
bool | collectable = false |
entityType | eType |
bool | jumping = false |
bool | isGrounded = false |
EntityManager * | entityManager |
Vector2D | initialPosition |
Vector2D | initialVelocity |
Represents an interactable entity in the game that includes Main Character, NPC, Tiles , and etc.
GameEntity::GameEntity | ( | entityType | eType | ) |
Constructor of GameEntity.
eType | an Enum of entityType |
GameEntity::~GameEntity | ( | ) |
Destructor of GameEntity.
void GameEntity::AddComponent | ( | std::shared_ptr< Component > | component | ) |
Adds different components to the GameEntity.
Adds component to the component vector in GameEntity.
component | Shared pointer to the Component object |
std::shared_ptr<Component> | component |
SDL_Event GameEntity::GetEvent | ( | ) |
Returns the Event for GameEntity.
Returns the event stored in GameEntity
int GameEntity::GetHeight | ( | ) |
SDL_Rect * GameEntity::GetRectangle | ( | ) |
Returns the Rectangle for GameEntity.
Returns the rectangle stored in GameEntity.
int GameEntity::GetWidth | ( | ) |
void GameEntity::Render | ( | ) |
Renders the object on screen for the GameEntity Class.
Calls all the render functions for each component in GameEntity
void GameEntity::Reset | ( | ) |
Resets the GameEntity.
void GameEntity::SetEvent | ( | SDL_Event & | e | ) |
Sets the SDL_Event for GameEntity class.
Sets the GameEntity's event attribute to the param.
e | SDL_Event |
SDL_Event | e |
void GameEntity::SetManager | ( | EntityManager * | entityManager | ) |
Sets EntityManager for GameEntity.
entity | A pointer to EntityManager object |
void GameEntity::ShutDown | ( | ) |
Destrotys and free attributes of the GameEntity Class.
Initializes attributes for the GameEntity object.
Updates the position of the game entity.
position | A Vector2D object that takes in x&y coordinates for the GameEntity |
velocity | A Vector2D object that takes in x&y velocity for the GameEntity |
width | The width of the GameEntity |
height | The height of the GameEntity |
GameEntity | &entity |
void GameEntity::Update | ( | ) |
Updates the position of the game entity.
Calls all the update functions for each component in GameEntity
int GameEntity::arrayPos = 0 |
bool GameEntity::cameraFlag = false |
bool GameEntity::collectable = false |
std::vector<int> GameEntity::collectablesAvailable |
bool GameEntity::collectItemSound = false |
bool GameEntity::deathSound = false |
SDL_Rect GameEntity::dest |
bool GameEntity::eatSound = false |
EntityManager* GameEntity::entityManager |
entityType GameEntity::eType |
SDL_RendererFlip GameEntity::flip = SDL_FLIP_NONE |
Vector2D GameEntity::initialPosition |
Vector2D GameEntity::initialVelocity |
bool GameEntity::isGrounded = false |
bool GameEntity::jumping = false |
bool GameEntity::jumpSound = false |
int GameEntity::lives = 3 |
bool GameEntity::lose = false |
SDL_Texture* GameEntity::m_texture |
Vector2D GameEntity::position |
SDL_Rect GameEntity::rect |
int GameEntity::score = 0 |
SDL_Rect GameEntity::src |
Vector2D GameEntity::velocity |
bool GameEntity::win = false |
int GameEntity::xPosTile = 0 |