• Fading Colors
    4 replies, posted
I am trying to make text go from green to red depending on the players health. I would like to be able to edit the starting color and ending color. I think you would use math.clamp but I havn't really messed with it in the way I am wanting to do something. 100% ( 0, 208, 0, 255 ) 1% ( 208, 0, 0, 255 )
Like this? [code]local hp = LocalPlayer():Health() local color = Color( 208 - hp / 100 * 208, hp / 100 * 208, 0 )[/code]
[QUOTE=Entoros;18930261]Like this? [code]local hp = LocalPlayer():Health() local color = Color( 208 - hp / 100 * 208, hp / 100 * 208, 0 )[/code][/QUOTE] Order of operations :byodood:
[QUOTE=Gbps;18932763]Order of operations :byodood:[/QUOTE] Seems to check out with BIDMAS. Does Lua use BIDMAS or just go from left to right?
[QUOTE=MegaJohnny;18934235]Seems to check out with BIDMAS. Does Lua use BIDMAS or just go from left to right?[/QUOTE] it does indeed use BIDMAS 'ol chap.
Sorry, you need to Log In to post a reply to this thread.