SDL SPOOKY PLATFORMER ENGINE  0.2.0
An implementation of a platformer using sdl, implemented using an entity component system and efficient collision management.
HealthComponent.hpp
Go to the documentation of this file.
1 #ifndef HEALTHCOMPONENT_HPP
2 #define HEALTHCOMPONENT_HPP
3 
4 #include "Component.hpp"
5 #include "TextUpdaters.hpp"
6 #include "GameManager.hpp"
7 
9 #define DAMAGE_INVINCIBILITY_TIME 1500
10 
11 class HealthComponent: public Component {
12  public:
14  HealthComponent(unsigned int maxHealth);
16 
17  void Update(float deltaTime);
18 
20  void HealthDown();
21 
22  bool invincible;
23 
24  friend class HealthUpdate;
25  private:
26 
28  unsigned int lastDamaged;
29 
31  unsigned int health;
32  unsigned int maxHealth;
33 };
34 #endif
Definition: TextUpdaters.hpp:27
bool invincible
Definition: HealthComponent.hpp:22
void HealthDown()
Reduces this component's health by one. If this reduces it to zero end the game.
Definition: HealthComponent.cpp:14
void Update(float deltaTime)
Update this component according to the deltaTime.
Definition: HealthComponent.cpp:7
HealthComponent(unsigned int maxHealth)
Creates a health component with the given maximumHealth.
Definition: HealthComponent.cpp:3
~HealthComponent()
Definition: HealthComponent.cpp:5
Definition: Component.hpp:13
Definition: HealthComponent.hpp:11