Provides functions to detect collision. More...
#include <CollisionComponent.hpp>
Public Member Functions | |
CollisionComponent (int w, int h) | |
~CollisionComponent () | |
void | SetCurrPos (int x, int y) |
std::pair< int, int > | GetProcessedPos () |
bool | CheckCollisionWithWall (bool &onGround) |
COLLISION_DIRECTION | CheckCollisionWithTile (TileMap *currMap, bool &onGround, int collider_type) |
Position | getStartPos () |
returns the generated start pos More... | |
Public Member Functions inherited from Component | |
Component () | |
~Component () | |
Provides functions to detect collision.
CollisionComponent::CollisionComponent | ( | int | w, |
int | h | ||
) |
Initialize object's collider with a box size
CollisionComponent::~CollisionComponent | ( | ) |
Deconstructor of a box collider
COLLISION_DIRECTION CollisionComponent::CheckCollisionWithTile | ( | TileMap * | currMap, |
bool & | onGround, | ||
int | collider_type | ||
) |
Process tile collision Type: 1 is player; 2 is monster
bool CollisionComponent::CheckCollisionWithWall | ( | bool & | onGround | ) |
Process wall collision
std::pair< int, int > CollisionComponent::GetProcessedPos | ( | ) |
Get the position after collision processed
Position CollisionComponent::getStartPos | ( | ) |
returns the generated start pos
void CollisionComponent::SetCurrPos | ( | int | x, |
int | y | ||
) |
Update the collider pos with the object pos. COuld be improved if we can share a transform component