user1526474
user1526474

Reputation: 945

Cocos2D - Change color of a sprite to what it was

I am changing the color of my sprite using the following code

 sprite.color = ccc3(255, 0, 0);

it changes the color to red..

How can I change the color to what it was??

Thanks..

Upvotes: 2

Views: 5210

Answers (1)

yannicuLar
yannicuLar

Reputation: 3133

You can return to original color by using

sprite.color = ccc3(255, 255, 255);

the original color was not lost. the tint methods (ccc3 in this case) are not adding-color, but darkening the individual RGB channels. That's the reason you cant tint a black image to any other color.

In your example, you didn't paint your sprite Red. You've just cut all channels except the red one

Upvotes: 7

Related Questions