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. ([url]https://www.youtube.com/watch?v=pucTs7uR7aY[/url]) (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 [URL="https://facepunch.com/showthread.php?t=1576959"]previous thread.[/URL]
1. You could just draw another shape behind the actual healthbar and make it smaller after the top layer.
2. Check if the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Health]Entity:Health[/url] is smaller or equal to half of [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetMaxHealth]Entity:GetMaxHealth[/url]
[QUOTE=txike;52629894]Stop making threads when you could just ask the question in your [URL="https://facepunch.com/showthread.php?t=1576959"]previous thread.[/URL]
1. You could just draw another shape behind the actual healthbar and make it smaller after the top layer.
2. Check if the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Health]Entity:Health[/url] is smaller or equal to half of [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetMaxHealth]Entity:GetMaxHealth[/url][/QUOTE]
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?
[QUOTE=Scepto;52629982]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?[/QUOTE]
1. It works and looks fine as long as you don't have any transparency.
2. if health >= maxhealth / 2 then
[QUOTE=txike;52630077]1. It works and looks fine as long as you don't have any transparency.
2. if health >= maxhealth / 2 then[/QUOTE]
if health <= maxhealth / 2 then*
[QUOTE=FireWolf2525;52630087]if health <= maxhealth / 2 then*[/QUOTE]
So.... Where should i apply it?
Here is my code:
[code] draw.RoundedBox( 0, 800, ScrH() - 90, 260 * hp, 45, Color( 225, 255, 255, 150)) [/code]
Thank you <3
[QUOTE=Scepto;52630135]So.... Where should i apply it?
Here is my code:
[code] draw.RoundedBox( 0, 800, ScrH() - 90, 260 * hp, 45, Color( 225, 255, 255, 150)) [/code]
Thank you <3[/QUOTE]
[url]https://facepunch.com/showthread.php?t=1576959[/url]
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?
[QUOTE=FireWolf2525;52630182][url]https://facepunch.com/showthread.php?t=1576959[/url]
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?[/QUOTE]
Gradually go to red...
And the other topic was for something else but still thank you for your help !
[QUOTE=Scepto;52630237]Gradually go to red...
And the other topic was for something else but still thank you for your help ![/QUOTE]
Put this code AFTER healthAng:
[code]
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
[/code]
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 [code]Color( 73 + ( i * 2 ), 255 - ( i * 2 ), 73, 200 )[/code]
[QUOTE=FireWolf2525;52630261]Put this code AFTER healthAng:
[code]
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
[/code]
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 [code]Color( 73 + ( i * 2 ), 255 - ( i * 2 ), 73, 200 )[/code][/QUOTE]
Thank you so much!
Sorry, you need to Log In to post a reply to this thread.