Hi,
I'm trying to code a script where the brightness of the player changes smoothly with position (getting closer to a light source and such). So, instead of using a region's LightLevel, I am using the Character.Tint function call. But I can't get it to do what I want (that is, no color change, just a luminance change).
The game is 32-bit color, the sprite was also 32-bit with alpha channel. Here is what I have tried (LuminanceInt here varies from 0 to 100 depending on position of the player):
player.Tint(255, 255, 255, 0, LuminanceInt); //No change at all
player.Tint(255, 255, 255, 1, LuminanceInt); //No change at all either
player.Tint(255, 255, 255, 100, LuminanceInt); //The lighting works as intended - but all colors are gone!
player.Tint(0,0,0, 0, LuminanceInt); //No change at all
player.Tint(0,0,0, 1, LuminanceInt); //No change at all
player.Tint(0,0,0, 100, LuminanceInt); //Again, the luminance changes but all colors are gone.
player.Tint(0,0,0, 50, LuminanceInt); //Works half-way: Half the color is gone, and setting Luminance to 0 is only half-brightness.
This does not seem to correspond to the manual:
QuoteThe LUMINANCE parameter allows you to adjust the brightness of the sprites at the same time. It ranges from 0-100. Passing 100 will draw the sprites at normal brightness. Lower numbers will darken the images accordingly, right down to 0 which will draw everything black.
Any ideas? Am I missing something?
hmmm odd, can you try importing a sprite without alpha channel and see if the result is the same?
You cannot achieve a luminance-only effect with the Character.Tint function, because the Tint function works like this:
1. Take copy of sprite
2. Darken sprite according to luminance setting
3. Colourise sprite according to RGB settings
4. Draw the new sprite over the original sprite with SATURATION% transparency.
Therefore, if you pass SATURATION as 0 or 1, it will have virtually no impact on the sprite.
But equally, if you pass it as 100, it will completely colourise the sprite too.