Hey, i'm attempting, not very well, to change the colour of my cannon, based on an overheat value.
what i'm doing currently, is getting the overheat value and dividing it by the maximum overheat value, which will give my a number between 0 and 1, so i can multiply that against 255 on the green and blue channel, so my cannon will go red, the more it overheats:
But, it would be alot better if i could adjust the the color to go from blue (255,255,255), to yellow to orange and then to red. 255,255,255 for blue, because that's the texture color.
NOW, there is a pattern, which is good:
blue (white basically) = 255,255,255
yellow = 255,255,0
orange = 255,128,64
red = 255,0,0
So, how can i, having a value of between 0 (no overheat, white basically) to 1 (total overheat, Red) change between those colors, simply by having that value?
I'm aware i could use lots of IF statements, but does anyone have a more elegant solution?
what i'm doing currently, is getting the overheat value and dividing it by the maximum overheat value, which will give my a number between 0 and 1, so i can multiply that against 255 on the green and blue channel, so my cannon will go red, the more it overheats:
overheat_value = 300 max_overheat_value = 600 cannon_color = overheat_value / max_overheat_value cannon_color = 0.5 EntityColor cannon_,255,255 - (255*cannon_color), 255 - (255*cannon_color) which equals: Entitycolor cannon_255,128,128
But, it would be alot better if i could adjust the the color to go from blue (255,255,255), to yellow to orange and then to red. 255,255,255 for blue, because that's the texture color.
NOW, there is a pattern, which is good:
blue (white basically) = 255,255,255
yellow = 255,255,0
orange = 255,128,64
red = 255,0,0
So, how can i, having a value of between 0 (no overheat, white basically) to 1 (total overheat, Red) change between those colors, simply by having that value?
I'm aware i could use lots of IF statements, but does anyone have a more elegant solution?