Changing colour of health bar when below 10%

paul2978

  • Posts: 12
Hi

Can anyone suggest a good method of changing the colour of the health bar once it reaches below a certain level say 10%?

Thanks

Paul

sdieters

  • Posts: 2068
You could copy the part where it draws the health bar and place the original code in an IF health >= 11, and the copied code underneath it inside the OTHERWISE block and change the colour in that code to red.

again, this is a simple idea, but there might be a more efficient way like making a colour attribute attribute and create an event like this:
IF health >= 11, set (colour attribute) to green.
OTHERWISE, set (colour attribute) to red.
But I'm not sure if that is even possible.

I'm just growing these ideas around from my phone without having access to stencyl, so no succes guaranteed =P
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

JohnGuySmith

  • Posts: 56
just change the actor's (health bar) animation

I would do this by making an updated statement saying
if gameatibute < 10
switch animation to DifferentColourAnimation

...though alternatively you could just change the font colour of he amour of health you have!
Zed20 Studios...Check out our apps in the App Store!


sdieters

  • Posts: 2068
@john. I think he is using the health bar from the run and gun project, and as far as I know that bar is code generated, and thus it has no animation that he can change.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p