Skip to content

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.

One Trackback/Pingback

  1. Api V0.8 Changes To Coloring Sprites « Ward’s Words on Monday, October 12, 2009 at 1:33 PM

    […] 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. This entry was posted on Sunday, …Continue Reading […]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*

Connect with Facebook

*