3
\$\begingroup\$

In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies. I'd like to change the color of the circles programatically. What's the easiest way to do this?

So far I'm just assigning a CCSprite* to the b2body->userData. So perhaps I can change the colors in my sprite sheet programmatically? Seems like there's an easier way. I'm just not sure what it is.

Cheers!

\$\endgroup\$
5
\$\begingroup\$

cocos2d CCSprites have a three byte color property. You can use it like sprite.color = ccc3(r, g, b).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.