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\$

1 Answer 1

5
\$\begingroup\$

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .