diff --git a/assets/bombs/explosion/blast.png b/assets/bombs/explosion/blast.png new file mode 100644 index 00000000..037212f6 Binary files /dev/null and b/assets/bombs/explosion/blast.png differ diff --git a/assets/bombs/explosion/explosion.glb b/assets/bombs/explosion/explosion.glb new file mode 100644 index 00000000..065ed85c Binary files /dev/null and b/assets/bombs/explosion/explosion.glb differ diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index fb9ef9b3..9bdc22ae 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -106,9 +106,25 @@ namespace BBM static const std::string unbreakableObj = unbreakableWallPath + objExtension; static const std::string unbreakablePnj = unbreakableWallPath + imageExtension; + for (int i = 0; i < height; i++) { + scene->addEntity("Bomb stopper") + .addComponent(-1, 0, i) + .addComponent>(); + scene->addEntity("Bomb stopper") + .addComponent(width + 1, 0, i) + .addComponent>(); + } + for (int i = 0; i < width; i++) { + scene->addEntity("Bomb stopper") + .addComponent(i, 0, -1) + .addComponent>(); + scene->addEntity("Bomb stopper") + .addComponent(i, 0, height + 1) + .addComponent>(); + } + scene->addEntity("Bottom Wall") .addComponent(Vector3f((width + 1) / 2, 0, -1)) - .addComponent>() .addComponent( WAL::Callback(), &MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75)) @@ -117,7 +133,6 @@ namespace BBM RAY::Vector3(width + 3, 1, 1)); scene->addEntity("Upper Wall") .addComponent(Vector3f((width + 1) / 2, 0, height + 1)) - .addComponent>() .addComponent( WAL::Callback(), &MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75)) @@ -126,7 +141,6 @@ namespace BBM RAY::Vector3(width + 3, 1, 1)); scene->addEntity("Left Wall") .addComponent(Vector3f(width + 1, 0, height / 2)) - .addComponent>() .addComponent( WAL::Callback(), &MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1)) diff --git a/sources/System/BombHolder/BombHolderSystem.cpp b/sources/System/BombHolder/BombHolderSystem.cpp index 6a5dac6e..d91c2a27 100644 --- a/sources/System/BombHolder/BombHolderSystem.cpp +++ b/sources/System/BombHolder/BombHolderSystem.cpp @@ -2,6 +2,7 @@ // Created by Zoe Roux on 5/31/21. // +#include #include #include "Component/Timer/TimerComponent.hpp" #include "System/Event/EventSystem.hpp" @@ -39,6 +40,13 @@ namespace BBM { if (count <= 0) return; + wal.getScene()->scheduleNewEntity("explosion") + .addComponent(position) + .addComponent(1s, [](WAL::Entity &explosion, WAL::Wal &wal) { + explosion.scheduleDeletion(); + }) + .addComponent("assets/bombs/explosion/explosion.glb", false, + std::make_pair(MAP_DIFFUSE, "assets/bombs/explosion/blast.png")); wal.getSystem().dispatchEvent([position, count](WAL::Wal &wal) { for (auto &[entity, pos, _] : wal.getScene()->view>()) { if (pos.position.round() == position) {