Dimming a character using Tint without changing the colour [SOLVED]

Started by paolo, Wed 19/09/2007 08:15:08

Previous topic - Next topic

paolo

I am using Tint() to dim a character. However, I can't find suitable values for the parameters. The character always seems to become desaturated (black and white).

I want the character to get dimmer (because he is standing in a darkened area) but to retain some colour.

Currently, I am using this:

cMyCharacter.Tint(0, 0, 0, 100, 50);

According to the manual, this means "apply (0, 0, 0) (ie, black) at maximum strength to the character and dim him to 50%". This is not what I want, because obviously it makes cMyCharacter become black and white.

I could (and should) change the zeros to something else, but I don't want to change his colour. I just want to make him dimmer but keep him the colour he is (dimmed colours, of course). Is there a simple way to do this? Lowering the saturation would do this, of course, but what RGB values should I use?

Thanks.


Mod Edit: You have to edit the title of the FIRST post, to have the change show in the forum listing.

Ashen

The manual's actually a bit misleading when it could to the Tint functions - in practice there doesn't seem to be a difference between tinting to 'black' (0,0,0) or to 'white' (255,255,255), both will wash the character out to the same greyscale look. It's the saturation and luminance values that'll lighten or darken them.
So, stick with 0,0,0 for the RGB and 50 for luminance, as you've got, but also drop the saturation to 50. That should 'darken' the sprite but keep the original colours visible, as you want. Play with the sat and lum values to get the right level of darkening.

Alternatively, as it's for a specific areea on screen, you could use a Region and set it's 'Light level' to < 100%. I think that does the same thing, but internally so you don' have to fiddle with the numbers quite so much...

I know what you're thinking ... Don't think that.

paolo

Thanks, Ashen. I'm working on something else now, but I'll give your suggestions a try when I come back to this issue.

EDIT: Setting both the saturation and luminance did what I wanted. Thanks.

Ashen

Good to hear it.

In future, when your problem is solved, please edit the title to include (SOLVED), or something similar. You might've noticed I've been doing it up 'til now, but it's getting hard to keep up with all your questions ;)
I know what you're thinking ... Don't think that.

paolo

Quote from: Ashen link=topic=32439.msg419192#msg419192
In future, when your problem is solved, please edit the title to include (SOLVED), or something similar. You might've noticed I've been doing it up 'til now, but it's getting hard to keep up with all your questions ;)

Yes, I had seen that - it's certainly very useful when you're searching the forums. For some strange reason, I had it in my head that only moderators could do that. Now done for this thread. Thanks again.

SMF spam blocked by CleanTalk