mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-30 01:05:24 +00:00
more cleanup
This commit is contained in:
@@ -15,6 +15,7 @@ namespace BBM
|
||||
{
|
||||
public:
|
||||
//! @brief Used to tell the collided axis
|
||||
//! @note Usage: (collidedAxis (int given by callback)) & CollidedAxis::X
|
||||
enum CollidedAxis {
|
||||
X = 1,
|
||||
Y = 2,
|
||||
@@ -53,7 +54,7 @@ namespace BBM
|
||||
//! @brief Constructor of collider with no callback
|
||||
CollisionComponent(WAL::Entity &entity, Vector3f positionOffset, Vector3f bound);
|
||||
|
||||
//! @brief Constructor no callback, same boundSize for all axis
|
||||
//! @brief Constructor no callback, same boundSize & positionOffset for all axis
|
||||
CollisionComponent(WAL::Entity &entity, float positionOffset, float boundSize);
|
||||
|
||||
//! @brief Default copy constructor
|
||||
|
||||
@@ -15,17 +15,9 @@ namespace BBM
|
||||
void MapGenerator::wallCollide(WAL::Entity &entity, const WAL::Entity &wall, int collidedAxis)
|
||||
{
|
||||
auto *mov = entity.tryGetComponent<MovableComponent>();
|
||||
auto posspec = entity.getComponent<PositionComponent>();
|
||||
auto posspecwall = wall.getComponent<PositionComponent>();
|
||||
|
||||
if (!mov)
|
||||
return;
|
||||
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
const auto &wallPos = wall.getComponent<PositionComponent>();
|
||||
auto diff = pos.position + mov->getVelocity() - wallPos.position;
|
||||
//mov->_velocity = Vector3f();
|
||||
//return;
|
||||
if (collidedAxis & CollisionComponent::CollidedAxis::X)
|
||||
mov->_velocity.x = 0;
|
||||
if (collidedAxis & CollisionComponent::CollidedAxis::Y)
|
||||
|
||||
Reference in New Issue
Block a user