HealthBar¶
Node for generic health bar.
Inherits : Node2D
Signals¶
- dead
- Signal emitted when the health bar reach
0
.Emitted by :
damage()
Received by : Ennemy._on_HealthBar_dead(), Player._on_HealthBar_dead()
Description¶
This is a general-purpose Node, implementing a neat health bar.
It has really basic behavior for now, no regeneration or stuff like this.
Behaviors handled so far :
- Possible to set the color of the health bar (the shadow is always set to orange).
- Change the maximum number of HP.
- Take damages.
- Heal HP.
Methods description¶
init(max_health, color=Color(168, 0, 0))
¶
Arguments
|
Method used to setup the health bar, with a specific number of maximum HP and specific color for the health bar.
set_health(h)
¶
Arguments
|
Set the current number of HP to a specific number.
This method should be used (and not manually change the property of the Node) in order to keep the animation clean.
set_max_health(h)
¶
Arguments
|
Set the maximum number of HP to a specific number.