Merge branch 'develop' of github.com:AnonymusRaccoon/Bomberman into lobby

This commit is contained in:
Zoe Roux
2021-06-15 16:36:02 +02:00
5 changed files with 29 additions and 10 deletions
+3
View File
@@ -50,5 +50,8 @@ namespace BBM
TagComponent &operator=(const TagComponent &) = delete;
};
// interact with bombs & stop the explosion
constexpr const char Blowable[] = "Blowable";
// interact with bombs (getting damage etc) but doesn't stop explosion
constexpr const char BlowablePass[] = "BlowablePass";
}
+7 -5
View File
@@ -80,7 +80,7 @@ namespace BBM
return;
wal.getScene()->scheduleNewEntity("Bonus")
.addComponent<PositionComponent>(position)
.addComponent<TagComponent<Blowable>>()
.addComponent<TagComponent<BlowablePass>>()
.addComponent<MovableComponent>()
.addComponent<HealthComponent>(1, [](WAL::Entity &entity, WAL::Wal &wal) {
entity.scheduleDeletion();
@@ -135,7 +135,7 @@ namespace BBM
static const std::string unbreakableObj = unbreakableWallPath + objExtension;
static const std::string unbreakablePnj = unbreakableWallPath + imageExtension;
for (int i = 0; i < height; i++) {
for (int i = 0; i < height + 1; i++) {
scene->addEntity("Bomb stopper")
.addComponent<PositionComponent>(-1, 0, i)
.addComponent<TagComponent<Blowable>>();
@@ -143,7 +143,7 @@ namespace BBM
.addComponent<PositionComponent>(width + 1, 0, i)
.addComponent<TagComponent<Blowable>>();
}
for (int i = 0; i < width; i++) {
for (int i = 0; i < width + 1; i++) {
scene->addEntity("Bomb stopper")
.addComponent<PositionComponent>(i, 0, -1)
.addComponent<TagComponent<Blowable>>();
@@ -450,14 +450,16 @@ namespace BBM
int floor = 2;
for (int i = 0; i < width + 1; i++) {
if (map[std::make_tuple(i, 0, height)] == NOTHING && map[std::make_tuple(i, 0, 0)] == NOTHING) {
if (map[std::make_tuple(i, 0, 0)] != UPPERFLOOR && map[std::make_tuple(i, 0, 0)] != HOLE
&& map[std::make_tuple(i, 0, 0)] != BUMPER) {
floor -= 1;
break;
}
}
for (int i = width / 2 - width / 4; i < width / 2 + width / 4 + 1; i++) {
for (int j = height / 2 - height / 4; j < height / 2 + height / 4 + 1; j++) {
if (map[std::make_tuple(i, 0, i)] == NOTHING) {
if (map[std::make_tuple(i, 0, j)] != UPPERFLOOR && map[std::make_tuple(i, 0, j)] != HOLE
&& map[std::make_tuple(i, 0, j)] != BUMPER) {
floor -= 1;
break;
}
+3 -3
View File
@@ -33,7 +33,7 @@ namespace BBM
.addComponent<SoundComponent>(sounds);
auto &raylibLogo = scene->addEntity("raylib logo")
.addComponent<PositionComponent>(1920 / 4, 1080 / 1.75, 0)
.addComponent<PositionComponent>(1920 / 3.5, 1080 / 1.75, 0)
.addComponent<Drawable2DComponent, RAY::Texture>("assets/raylib.png");
auto &raylibText = scene->addEntity("raylib text")
.addComponent<PositionComponent>(1920 / 4, 1080 / 2, 0)
@@ -42,8 +42,8 @@ namespace BBM
.addComponent<PositionComponent>(1920 / 4, 1080 / 4, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Many Thanks to:", 35, RAY::Vector2(), BLACK);
auto &BriansRepo = scene->addEntity("thx brian")
.addComponent<PositionComponent>(1920 / 3.5, 1080 / 3.5, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Brian Guitteny (and his team)", 35, RAY::Vector2(), BLACK);
.addComponent<PositionComponent>(1920 / 3.5, 1080 / 3.25, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Brian Guitteny (and his team)\nAssets used by their permission", 35, RAY::Vector2(), BLACK);
auto &team = scene->addEntity("team")
.addComponent<PositionComponent>(1920 / 1.5, 1080 / 3.5, 0)
.addComponent<Drawable2DComponent, RAY2D::Text>("Team:\n Zoe Roux\n Clément Le Bihan\n Arthur Jamet\n Louis Auzuret\n Benjamin Henry\n Tom Augier", 35, RAY::Vector2(), BLACK);
+1 -1
View File
@@ -55,7 +55,7 @@ namespace BBM
.addComponent<GravityComponent>()
.addComponent<BumperTimerComponent>()
// .addComponent<ShaderComponentModel>("assets/shaders/glsl330/predator.fs")
.addComponent<TagComponent<Blowable>>()
.addComponent<TagComponent<BlowablePass>>()
.addComponent<AnimationsComponent>("assets/player/player.iqm", 3)
.addComponent<CollisionComponent>(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75})
.addComponent<MovableComponent>()
+15 -1
View File
@@ -44,7 +44,7 @@ namespace BBM
return;
wal.getScene()->scheduleNewEntity("explosion")
.addComponent<PositionComponent>(position)
.addComponent<TimerComponent>(1s, [](WAL::Entity &explosion, WAL::Wal &wal) {
.addComponent<TimerComponent>(500ms, [](WAL::Entity &explosion, WAL::Wal &wal) {
explosion.scheduleDeletion();
})
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/explosion/explosion.glb", false,
@@ -60,6 +60,12 @@ namespace BBM
return;
}
}
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<BlowablePass>>()) {
if (pos.position.round() == position) {
if (auto *health = entity.tryGetComponent<HealthComponent>())
health->takeDmg(1);
}
}
if (expansionDirections & ExpansionDirection::FRONT) {
_dispatchExplosion(position + Vector3f{1, 0, 0}, wal, size - 1, ExpansionDirection::FRONT);
}
@@ -87,6 +93,14 @@ namespace BBM
{
this->_wal.getScene()->scheduleNewEntity("Bomb")
.addComponent<PositionComponent>(position.round())
.addComponent<HealthComponent>(1, [](WAL::Entity &entity, WAL::Wal &wal) {
// the bomb explode when hit
entity.scheduleDeletion();
auto &pos = entity.getComponent<PositionComponent>();
auto &bombDetails = entity.getComponent<BasicBombComponent>();
BombHolderSystem::_dispatchExplosion(pos.position, wal, bombDetails.explosionRadius);
})
.addComponent<TagComponent<BlowablePass>>()
.addComponent<BasicBombComponent>(holder.damage, holder.explosionRadius, id)
.addComponent<TimerComponent>(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion)
.addComponent<CollisionComponent>(