API v0.8 Changes to Coloring Sprites

Luke Hatcher’s excellent write-up on coloring sprites is a bit out of date for the latest version (v0.8.0) of Cocos2D.

Some very minor changes are necessary to get the example to work.

Originally, the tutorial sets both the position and color with the following two lines, or:

[redSprite setPosition:cpv(200, 160)];
[redSprite setRGB:255 :0 :0];

We need to change cpv to ccp and setRGB:r :g :b to setColor:ccc3(r,g,b), or:

[redSprite setPosition:ccp(200, 160)];
[redSprite setColor:ccc3(255,0,0)];

That is it to get the example working.

Author: Ward

I’m the creator and operator of this little corner of the internets, writing on all things related to art and more specifically my experiences trying to figure this whole thing out. I guess I’m trying to figure out life, too, but mostly I just post about art here.

0 thoughts on “API v0.8 Changes to Coloring Sprites”

Breath some fire into this post!

This site uses Akismet to reduce spam. Learn how your comment data is processed.