Hello guys,
I'm having some trouble with the Player Health HUD.
The concept is this:
The Player's Hit Points are represented by Hearts. Each Heart is a different Sprite.
The Player can purchase Items that increase his Max Health to a maximum of 8.
He starts with 3 though.
Every time he gets hit, the Heart that is furthest from the point 0 in x gets dark (Animation change.)
I managed to accomplish this and it works great when the Player gets damaged by 1.
If damaged by more than one though, the system falls apart and only shows one damaged heart from then on.
I've tried doing it by my own functions and Dictionary and by using the Health behavior bought from the Scirra Store with no luck.
Here is what I'm doing:
[Creating the Heart Sprites]
On start of layout
Repeat.Player.PlayerMaxHealth Times -> Create object HUD_Heart on layer "HUD" at (40 + (loopindex * 14), 24)
[Damage]
Player - On Health Damaged
HUD_Hearts - Pick furthest to (0,24)
HUD_Hearts - Is animation "Default" playing
Repeat Player.Health.LastDamagePoints times (Health behavior includes value for the last damage received)
->
Set animation to "Dark"
(Wait 0.5)
So, do you have any ideas? As I've said it works fine until the character gets damaged for more than 1 HP.
I've tried various variations on the above logic yet nothing changed.
I'm quite new to Construct though so maybe I'm missing something?