Potato Engine
Loading...
Searching...
No Matches
Entity.cpp
Go to the documentation of this file.
1
2
3#include <algorithm>
4
5#include "Entity.hpp"
6
7Entity::Entity() {
8
9}
10
11Entity::~Entity() {
12
13}
14
15float Entity::TakeDamage(float damage) {
16 Health = std::clamp(Health - damage, 0.f, MaxHealth);
17 return Health;
18}
19
20float Entity::AddHealth(float amount) {
21 Health = std::clamp(Health + amount, 0.f, MaxHealth);
22 return Health;
23}
24
25float Entity::GetHealth() const {
26 return Health;
27}
float AddHealth(float amount)
Adds health to entity.
Definition Entity.cpp:20
float GetHealth() const
Gets health.
Definition Entity.cpp:25
float TakeDamage(float damage)
Delivers damage to the entity.
Definition Entity.cpp:15