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