diff --git a/sources/Component/Tag/TagComponent.hpp b/sources/Component/Tag/TagComponent.hpp index fe07f70e..74bf6253 100644 --- a/sources/Component/Tag/TagComponent.hpp +++ b/sources/Component/Tag/TagComponent.hpp @@ -50,10 +50,13 @@ namespace BBM TagComponent &operator=(const TagComponent &) = delete; }; + // interact with bombs & stop the explosion constexpr const char Blowable[] = "Blowable"; constexpr const char Unbreakable[] = "Unbreakable"; constexpr const char Breakable[] = "Breakable"; constexpr const char Hole[] = "Hole"; constexpr const char Bumper[] = "Bumper"; constexpr const char Player[] = "Player"; + // interact with bombs (getting damage etc) but doesn't stop explosion + constexpr const char BlowablePass[] = "BlowablePass"; } diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index 6a88c984..b3c35484 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -80,7 +80,7 @@ namespace BBM return; wal.getScene()->scheduleNewEntity("Bonus") .addComponent(position) - .addComponent>() + .addComponent>() .addComponent() .addComponent(1, [](WAL::Entity &entity, WAL::Wal &wal) { entity.scheduleDeletion(); diff --git a/sources/Runner/CreditScene.cpp b/sources/Runner/CreditScene.cpp index d87e47be..fa77c9ff 100644 --- a/sources/Runner/CreditScene.cpp +++ b/sources/Runner/CreditScene.cpp @@ -33,7 +33,7 @@ namespace BBM .addComponent(sounds); auto &raylibLogo = scene->addEntity("raylib logo") - .addComponent(1920 / 4, 1080 / 1.75, 0) + .addComponent(1920 / 3.5, 1080 / 1.75, 0) .addComponent("assets/raylib.png"); auto &raylibText = scene->addEntity("raylib text") .addComponent(1920 / 4, 1080 / 2, 0) @@ -42,8 +42,8 @@ namespace BBM .addComponent(1920 / 4, 1080 / 4, 0) .addComponent("Many Thanks to:", 35, RAY::Vector2(), BLACK); auto &BriansRepo = scene->addEntity("thx brian") - .addComponent(1920 / 3.5, 1080 / 3.5, 0) - .addComponent("Brian Guitteny (and his team)", 35, RAY::Vector2(), BLACK); + .addComponent(1920 / 3.5, 1080 / 3.25, 0) + .addComponent("Brian Guitteny (and his team)\nAssets used by their permission", 35, RAY::Vector2(), BLACK); auto &team = scene->addEntity("team") .addComponent(1920 / 1.5, 1080 / 3.5, 0) .addComponent("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); diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index f7f0107e..50242df1 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -55,7 +55,7 @@ namespace BBM .addComponent() .addComponent() // .addComponent("assets/shaders/glsl330/predator.fs") - .addComponent>() + .addComponent>() .addComponent("assets/player/player.iqm", 3) .addComponent(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75}) .addComponent() diff --git a/sources/System/BombHolder/BombHolderSystem.cpp b/sources/System/BombHolder/BombHolderSystem.cpp index 6fe1055d..d67f16c7 100644 --- a/sources/System/BombHolder/BombHolderSystem.cpp +++ b/sources/System/BombHolder/BombHolderSystem.cpp @@ -44,7 +44,7 @@ namespace BBM return; wal.getScene()->scheduleNewEntity("explosion") .addComponent(position) - .addComponent(1s, [](WAL::Entity &explosion, WAL::Wal &wal) { + .addComponent(500ms, [](WAL::Entity &explosion, WAL::Wal &wal) { explosion.scheduleDeletion(); }) .addComponent("assets/bombs/explosion/explosion.glb", false, @@ -60,6 +60,12 @@ namespace BBM return; } } + for (auto &[entity, pos, _] : wal.getScene()->view>()) { + if (pos.position.round() == position) { + if (auto *health = entity.tryGetComponent()) + 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(position.round()) + .addComponent(1, [](WAL::Entity &entity, WAL::Wal &wal) { + // the bomb explode when hit + entity.scheduleDeletion(); + auto &pos = entity.getComponent(); + auto &bombDetails = entity.getComponent(); + BombHolderSystem::_dispatchExplosion(pos.position, wal, bombDetails.explosionRadius); + }) + .addComponent>() .addComponent(holder.damage, holder.explosionRadius, id) .addComponent(BombHolderSystem::explosionTimer, &BombHolderSystem::_bombExplosion) .addComponent(