mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 08:13:18 +00:00
Remove controllable instead of checking health
This commit is contained in:
@@ -82,6 +82,9 @@ namespace BBM
|
||||
.addComponent<HealthComponent>(1, [](WAL::Entity &entity, WAL::Wal &) {
|
||||
auto &animation = entity.getComponent<AnimationsComponent>();
|
||||
animation.setAnimIndex(5);
|
||||
|
||||
if (entity.hasComponent<ControllableComponent>())
|
||||
entity.removeComponent<ControllableComponent>();
|
||||
if (entity.hasComponent<TimerComponent>())
|
||||
return;
|
||||
entity.addComponent<TimerComponent>(1s, [](WAL::Entity &entity, WAL::Wal &wal) {
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BBM
|
||||
auto health = entity->tryGetComponent<HealthComponent>();
|
||||
Vector2f move = controllable.move.normalized() * controllable.speed;
|
||||
|
||||
if (health->getHealthPoint() <= 0)
|
||||
if (health && health->getHealthPoint() <= 0)
|
||||
return;
|
||||
movable.addForce(Vector3f(move.x, 0, move.y));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user