Why is this code not working?
https://gyazo.com/1e5384ee9b1012a39e59931c4d78169c
I dont know whats wrong with it the code just doesnt come up at all the original source code is
Color color = {float((100 - health) / 100.0), float((health) / 100.0), 0.0f, 0.8f};
why would anyone do 255/255 instead of putting actual float values there is beyond me ._.
You are dividing any number by 255, without appending .f, which means you are dividing an int by an int, not a float by a float. Integers cant hold decimal fractions, which means that the division will either be 0 or 1, nothing inbetween, which is what you want. Divide a float by a float instead. ( 150.f / 255.f ). Casting the result to float doesn't work either, as the division is done first and the result then casted to a float.
You are creating a variable called color in your code, which is destroyed at the line right after. You aren't using the variable you just created, it's destroyed right after. If you have a color variable in higher scope somewhere, use that one instead of creating a new one on that line.