mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-26 15:58:12 +00:00
Update speedup bonus & fixing one bug (double bonus/...)
This commit is contained in:
+13
-2
@@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
#include <Component/Collision/CollisionComponent.hpp>
|
||||
#include <Component/Controllable/ControllableComponent.hpp>
|
||||
#include "Component/Movable/MovableComponent.hpp"
|
||||
#include "Bonus.hpp"
|
||||
#include "Component/BombHolder/BombHolderComponent.hpp"
|
||||
@@ -10,6 +11,8 @@
|
||||
namespace BBM {
|
||||
void Bonus::BombUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||
{
|
||||
if (bonus.shouldDelete())
|
||||
return;
|
||||
if (player.hasComponent<BombHolderComponent>()) {
|
||||
auto &bombHolder = player.getComponent<BombHolderComponent>();
|
||||
bombHolder.maxBombCount++;
|
||||
@@ -18,6 +21,8 @@ namespace BBM {
|
||||
|
||||
void Bonus::DamageIncreasedBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||
{
|
||||
if (bonus.shouldDelete())
|
||||
return;
|
||||
if (player.hasComponent<BombHolderComponent>()) {
|
||||
auto &bombHolder = player.getComponent<BombHolderComponent>();
|
||||
bombHolder.damage++;
|
||||
@@ -26,6 +31,8 @@ namespace BBM {
|
||||
|
||||
void Bonus::ExplosionRangeBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||
{
|
||||
if (bonus.shouldDelete())
|
||||
return;
|
||||
if (player.hasComponent<BombHolderComponent>()) {
|
||||
auto &bombHolder = player.getComponent<BombHolderComponent>();
|
||||
bombHolder.explosionRadius++;
|
||||
@@ -34,14 +41,18 @@ namespace BBM {
|
||||
|
||||
void Bonus::SpeedUpBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||
{
|
||||
if (bonus.shouldDelete())
|
||||
return;
|
||||
if (!player.hasComponent<MovableComponent>())
|
||||
return;
|
||||
auto &movable = player.getComponent<MovableComponent>();
|
||||
movable.addForce(Vector3f(1, 0, 1));
|
||||
auto &controllable = player.getComponent<ControllableComponent>();
|
||||
controllable.speed += 0.02f;
|
||||
}
|
||||
|
||||
void Bonus::IgnoreWallsBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
|
||||
{
|
||||
if (bonus.shouldDelete())
|
||||
return;
|
||||
if (player.hasComponent<BombHolderComponent>()) {
|
||||
auto &bombHolder = player.getComponent<BombHolderComponent>();
|
||||
std::cout << "Explosion is supposed to pass through walls here" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user