Merging game

This commit is contained in:
Zoe Roux
2021-05-24 15:46:46 +02:00
14 changed files with 476 additions and 0 deletions
@@ -0,0 +1,43 @@
//
// Created by Tom Augier on 2021-05-20.
// Edited by Benjamin Henry on 2021-05-20.
// Edited by Louis Auzuret on 2021-05-20.
//
#include "HealthComponent.hpp"
namespace Bomberman
{
HealthComponent::HealthComponent(WAL::Entity &entity)
: WAL::Component(entity),
_healthPoint()
{}
HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint)
: WAL::Component(entity),
_healthPoint(healthPoint)
{}
WAL::Component *HealthComponent::clone(WAL::Entity &entity) const
{
return new HealthComponent(entity);
}
void HealthComponent::addHealthPoint(unsigned int healthPoint)
{
this->_healthPoint += healthPoint;
}
void HealthComponent::takeDmg(unsigned int damage)
{
if (damage >= this->_healthPoint) {
this->_healthPoint = 0;
} else
this->_healthPoint -= damage;
}
unsigned int HealthComponent::getHealthPoint(void) const
{
return (this->_healthPoint);
}
}