Healthbar Effect

Hello,

I got a another question.
I want to add some cool effect to the healthbar.

Such as:

  1. Health bar transition when getting damage. (https://www.youtube.com/watch?v=pucTs7uR7aY) (0.23)
  2. When a player is under the 50% of health the bar get’s red.

Hope you can help me with this! Thank you!

Stop making threads when you could just ask the question in your previous thread.

  1. You could just draw another shape behind the actual healthbar and make it smaller after the top layer.
  2. Check if the

Entity:Health is smaller or equal to half of

Entity:GetMaxHealth

  1. Then it doesn’t work, because the layer just goes even with the other. I need it like the youtube link.
  2. How would i do that?
  1. It works and looks fine as long as you don’t have any transparency.
  2. if health >= maxhealth / 2 then

if health <= maxhealth / 2 then*

So… Where should i apply it?
Here is my code:


   draw.RoundedBox( 0, 800, ScrH() - 90, 260 * hp, 45, Color( 225, 255, 255, 150)) 

Thank you <3

http://forum.facepunch.com/showthread.php?t=1576959
I thought you were aiming for a circular health bar…?

By the way, when the player’s health goes under 50%, do you want it to gradually go to red or just go instantly red like GTA V when you get to 25% health or below?

Gradually go to red…

And the other topic was for something else but still thank you for your help !

Put this code AFTER healthAng:



	if health <= maxHealth / 2 then
		local i = maxHealth - health
		draw.Arc( 160, 160, 150, 10, 90, 90 + healthAng, 1, Color( 73 + i, 255 - i, 73, 200 ) )
	end


The colours are just an example going from green to a reddish green. If you want it to go more red, then change the i in Color to


Color( 73 + ( i * 2 ), 255 - ( i * 2 ), 73, 200 )

Thank you so much!