mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-20 13:25:10 +00:00
bonuses are collidable but the explosion is called multiple times
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Items/Bonus.hpp>
|
#include <Items/Bonus.hpp>
|
||||||
#include <Component/Levitate/LevitateComponent.hpp>
|
#include <Component/Levitate/LevitateComponent.hpp>
|
||||||
|
#include "Component/Movable/MovableComponent.hpp"
|
||||||
#include <Component/Timer/TimerComponent.hpp>
|
#include <Component/Timer/TimerComponent.hpp>
|
||||||
#include <Component/Tag/TagComponent.hpp>
|
#include <Component/Tag/TagComponent.hpp>
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ namespace BBM
|
|||||||
wal.getScene()->scheduleNewEntity("Bonus")
|
wal.getScene()->scheduleNewEntity("Bonus")
|
||||||
.addComponent<PositionComponent>(position)
|
.addComponent<PositionComponent>(position)
|
||||||
.addComponent<TagComponent<Blowable>>()
|
.addComponent<TagComponent<Blowable>>()
|
||||||
|
.addComponent<MovableComponent>()
|
||||||
.addComponent<HealthComponent>(1, [](WAL::Entity &entity, WAL::Wal &wal) {
|
.addComponent<HealthComponent>(1, [](WAL::Entity &entity, WAL::Wal &wal) {
|
||||||
entity.scheduleDeletion();
|
entity.scheduleDeletion();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ namespace BBM
|
|||||||
{
|
{
|
||||||
if (radiusToDo <= 0)
|
if (radiusToDo <= 0)
|
||||||
return;
|
return;
|
||||||
std::cout << "exploding at " << position << std::endl;
|
|
||||||
wal.getSystem<EventSystem>().dispatchEvent([position, radiusToDo, expansionDirections](WAL::Wal &wal) {
|
wal.getSystem<EventSystem>().dispatchEvent([position, radiusToDo, expansionDirections](WAL::Wal &wal) {
|
||||||
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<Blowable>>()) {
|
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<Blowable>>()) {
|
||||||
if (pos.position.round() == position) {
|
if (pos.position.round() == position) {
|
||||||
@@ -67,7 +66,7 @@ namespace BBM
|
|||||||
bomb.scheduleDeletion();
|
bomb.scheduleDeletion();
|
||||||
auto position = bomb.getComponent<PositionComponent>().position.round();
|
auto position = bomb.getComponent<PositionComponent>().position.round();
|
||||||
auto explosionRadius = bomb.getComponent<BasicBombComponent>().explosionRadius;
|
auto explosionRadius = bomb.getComponent<BasicBombComponent>().explosionRadius;
|
||||||
_dispatchExplosion(position, wal, 2);
|
_dispatchExplosion(position, wal, explosionRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BombHolderSystem::_spawnBomb(Vector3f position, BombHolderComponent &holder, unsigned id)
|
void BombHolderSystem::_spawnBomb(Vector3f position, BombHolderComponent &holder, unsigned id)
|
||||||
|
|||||||
Reference in New Issue
Block a user