mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 10:26:29 +00:00
fixing keyboard (he was switching between a and d)
This commit is contained in:
@@ -23,8 +23,14 @@ namespace BBM
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! @brief onCollide functions to be called
|
//! @brief onCollide functions to be called
|
||||||
|
//! @param first self
|
||||||
|
//! @param second the entity you collided
|
||||||
|
//! @param third the collision axis (to know which axis collided)
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> onCollide;
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> onCollide;
|
||||||
//! @brief onCollided functions to be called
|
//! @brief onCollided functions to be called
|
||||||
|
//! @param first the entity that collided you
|
||||||
|
//! @param second self
|
||||||
|
//! @param third the collision axis (to know which axis collided)
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> onCollided;
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> onCollided;
|
||||||
//! @brief Bound size on all axis
|
//! @brief Bound size on all axis
|
||||||
Vector3f bound;
|
Vector3f bound;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace BBM {
|
|||||||
|
|
||||||
void Bonus::SpeedUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
void Bonus::SpeedUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||||
{
|
{
|
||||||
std::cout << "soeed" << std::endl;
|
|
||||||
if (bonus.shouldDelete())
|
if (bonus.shouldDelete())
|
||||||
return;
|
return;
|
||||||
auto *controllable = player.tryGetComponent<ControllableComponent>();
|
auto *controllable = player.tryGetComponent<ControllableComponent>();
|
||||||
|
|||||||
+16
-13
@@ -17,10 +17,14 @@ using namespace std::chrono_literals;
|
|||||||
|
|
||||||
namespace BBM
|
namespace BBM
|
||||||
{
|
{
|
||||||
void MapGenerator::wallCollide(WAL::Entity &entity,
|
void MapGenerator::wallCollided(WAL::Entity &entity,
|
||||||
const WAL::Entity &wall,
|
const WAL::Entity &wall,
|
||||||
CollisionComponent::CollidedAxis collidedAxis)
|
CollisionComponent::CollidedAxis collidedAxis)
|
||||||
{
|
{
|
||||||
|
auto name = entity.getName();
|
||||||
|
if (name == "Unbreakable Wall" || name == "Breakable Block") {
|
||||||
|
name = "salut";
|
||||||
|
}
|
||||||
auto *mov = entity.tryGetComponent<MovableComponent>();
|
auto *mov = entity.tryGetComponent<MovableComponent>();
|
||||||
|
|
||||||
if (!mov)
|
if (!mov)
|
||||||
@@ -57,10 +61,9 @@ namespace BBM
|
|||||||
entity.scheduleDeletion();
|
entity.scheduleDeletion();
|
||||||
})
|
})
|
||||||
.addComponent<LevitateComponent>(position.y)
|
.addComponent<LevitateComponent>(position.y)
|
||||||
.addComponent<CollisionComponent>(func[bonusType - 1], [](WAL::Entity &bonus, const WAL::Entity &player, CollisionComponent::CollidedAxis axis) {
|
.addComponent<CollisionComponent>([](WAL::Entity &bonus, const WAL::Entity &player, CollisionComponent::CollidedAxis axis) {
|
||||||
bonus.scheduleDeletion();
|
bonus.scheduleDeletion();
|
||||||
std::cout << "called" << std::endl;
|
}, func[bonusType - 1], 0.5, .5)
|
||||||
}, 0.5, .5)
|
|
||||||
.addComponent<TimerComponent>(5s, [](WAL::Entity &bonus, WAL::Wal &wal){
|
.addComponent<TimerComponent>(5s, [](WAL::Entity &bonus, WAL::Wal &wal){
|
||||||
bonus.scheduleDeletion();
|
bonus.scheduleDeletion();
|
||||||
})
|
})
|
||||||
@@ -93,7 +96,7 @@ namespace BBM
|
|||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, 0.25, .75)
|
&MapGenerator::wallCollided, 0.25, .75)
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, unbreakablePng));
|
std::make_pair(MAP_DIFFUSE, unbreakablePng));
|
||||||
}
|
}
|
||||||
@@ -111,7 +114,7 @@ namespace BBM
|
|||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
||||||
RAY::Vector3(width + 3, 1, 1));
|
RAY::Vector3(width + 3, 1, 1));
|
||||||
@@ -120,7 +123,7 @@ namespace BBM
|
|||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
||||||
RAY::Vector3(width + 3, 1, 1));
|
RAY::Vector3(width + 3, 1, 1));
|
||||||
@@ -129,7 +132,7 @@ namespace BBM
|
|||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
||||||
RAY::Vector3(1, 1, height + 1));
|
RAY::Vector3(1, 1, height + 1));
|
||||||
@@ -137,7 +140,7 @@ namespace BBM
|
|||||||
.addComponent<PositionComponent>(Vector3f(-1, 0, height / 2))
|
.addComponent<PositionComponent>(Vector3f(-1, 0, height / 2))
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
std::make_pair(MAP_DIFFUSE, unbreakablePnj),
|
||||||
RAY::Vector3(1, 1, height + 1));
|
RAY::Vector3(1, 1, height + 1));
|
||||||
@@ -189,7 +192,7 @@ namespace BBM
|
|||||||
.addComponent<HealthComponent>(1, &MapGenerator::wallDestroyed)
|
.addComponent<HealthComponent>(1, &MapGenerator::wallDestroyed)
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, 0.25, .75)
|
&MapGenerator::wallCollided, 0.25, .75)
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(breakableObj, std::make_pair(MAP_DIFFUSE, breakablePng));
|
.addComponent<Drawable3DComponent, RAY3D::Model>(breakableObj, std::make_pair(MAP_DIFFUSE, breakablePng));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +228,7 @@ namespace BBM
|
|||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollide, 0.25, .75)
|
&MapGenerator::wallCollided, 0.25, .75)
|
||||||
.addComponent<Drawable3DComponent, RAY3D::Model>(UnbreakableObj,
|
.addComponent<Drawable3DComponent, RAY3D::Model>(UnbreakableObj,
|
||||||
std::make_pair(MAP_DIFFUSE, UnbreakablePng));
|
std::make_pair(MAP_DIFFUSE, UnbreakablePng));
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -155,9 +155,9 @@ namespace BBM
|
|||||||
static const std::string secondFloorHolePath;
|
static const std::string secondFloorHolePath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void wallCollide(WAL::Entity &entity,
|
static void wallCollided(WAL::Entity &entity,
|
||||||
const WAL::Entity &wall,
|
const WAL::Entity &wall,
|
||||||
CollisionComponent::CollidedAxis collidedAxis);
|
CollisionComponent::CollidedAxis collidedAxis);
|
||||||
static void wallDestroyed(WAL::Entity &entity, WAL::Wal &wal);
|
static void wallDestroyed(WAL::Entity &entity, WAL::Wal &wal);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace BBM
|
|||||||
collidedAxis += CollisionComponent::CollidedAxis::Z;
|
collidedAxis += CollisionComponent::CollidedAxis::Z;
|
||||||
}
|
}
|
||||||
if (collidedAxis) {
|
if (collidedAxis) {
|
||||||
colA.onCollide(other, entity, static_cast<CollisionComponent::CollidedAxis>(collidedAxis));
|
colA.onCollide(entity, other, static_cast<CollisionComponent::CollidedAxis>(collidedAxis));
|
||||||
colB.onCollided(entity, other, static_cast<CollisionComponent::CollidedAxis>(collidedAxis));
|
colB.onCollided(entity, other, static_cast<CollisionComponent::CollidedAxis>(collidedAxis));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user