<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Digitally Bold</title>
	<atom:link href="http://digitallybold.com/feed" rel="self" type="application/rss+xml" />
	<link>http://digitallybold.com</link>
	<description>iPhone Games, Flash Games, Mobile Games</description>
	<lastBuildDate>Fri, 13 Jan 2012 22:13:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Cocos2D: Additive Coloring &amp; Flash Style Tinting</title>
		<link>http://digitallybold.com/314/cocos2d-additive-sprite-color-tinting</link>
		<comments>http://digitallybold.com/314/cocos2d-additive-sprite-color-tinting#comments</comments>
		<pubDate>Fri, 13 Jan 2012 18:17:05 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=314</guid>
		<description><![CDATA[Here's the thing, Flash can color a sprite in ways that vanilla Cocos2d does not. We've seen quite a few articles on the web about how to color a CCSprite in order to use one sprite for a variety of purposes. This tutorial will show you how to additively color and also tint a sprite. It doesn't only work with white sprites anymore.]]></description>
			<content:encoded><![CDATA[<p>We all love Cocos2d. Well, I love Cocos2d and if you&#8217;re an iOS developer I&#8217;m sure you do too. I mean why not? It&#8217;s free and it&#8217;s a fantastic 2d game engine. Coinciding this love of Cocos2d comes a love of Flash. And while Flash may be taking a diminishing mobile presence it&#8217;s still one of the best platforms to develop a 2d game. I say this from a strictly development perspective, it&#8217;s just so easy to prototype and even develop a game in Flash. Mostly because the tools you need are just a couple lines of code away and it has years worth of frameworks and libraries to help get you where you want to go quickly.</p>
<p>Here&#8217;s the thing, Flash can color a sprite in ways that vanilla Cocos2d does not. We&#8217;ve seen quite a few articles on the web about how to color a CCSprite in order to use one sprite for a variety of purposes. And they have been excellent articles at that, here&#8217;s a couple if you want to check them out:</p>
<ul>
<li><a href="http://lukehatcher.com/post/449164972/coloring-sprites-with-cocos2d-iphone">Cheetah Lurk&#8217;s: Coloring Sprites with Cocos2d-iPhone</a></li>
<li><a href="http://brandontreb.com/Cocos2D-Tutorial-Dynamically-Coloring-Sprites/">Brandon Trebs&#8217;: Cocos2D Tutorial &#8211; Dynamically Coloring Sprites</a></li>
</ul>
<p>And this works incredibly well&#8230; until you need additive coloring. And don&#8217;t even think about tinting, that&#8217;s a whole new level of crazy.  You might be saying, there&#8217;s CCTintTo and CCTintBy actions in Cocos2d, it CAN tint. Well we&#8217;ll leave that to semantics, but to me CCTintTo and CCTintBy are not tinting anything. It&#8217;s just more of the same &#8220;subtractive&#8221; style of coloring that we get with Cocos2d. Before we go on, if you don&#8217;t know how to color a sprite as illustrated in the two articles above, I recommend you check them out. I&#8217;ll go into it with slight detail but it&#8217;s going to be important that you understand it because much of the same methods will be employed to get our additive and tinting effects.</p>
<h3>Seeing is Believing</h3>
<p>Okay so before I explain how we&#8217;re going to achieve coloring bliss let&#8217;s just take a look at what we&#8217;re going to be able to do.</p>
<p><a href="http://digitallybold.com/wp-content/uploads/2012/01/coloring1.png"><img class="alignnone size-medium wp-image-317" title="coloring1" src="http://digitallybold.com/wp-content/uploads/2012/01/coloring1-300x83.png" alt="" width="300" height="83" /></a><a href="http://digitallybold.com/wp-content/uploads/2012/01/coloring1.png"><br />
</a>Has this got you excited? No. Okay well let me explain. I took the same graphic created 3 sprites and used three different coloring methods to apply a setColor of pure blue. So in other words I ran <strong>[sprite setColor:ccc3(<span style="color: #ff0000;">0</span>, <span style="color: #00ff00;">0</span>, <span style="color: #0000ff;">255</span>)]</strong> on all three sprites and produced different results.</p>
<ul>
<li>SPRITE &#8211; This is our wonderful sprite before we&#8217;ve done any coloring.</li>
<li>DEFAULT &#8211; This is standard cocos2d way of coloring sprites. If you are wondering what really happened here then let me explain. We didn&#8217;t add any blue on the contrary we removed all the red and green. By setting red and green to 0 we removed all of their color from the sprite.</li>
<li>ADD &#8211; This is the first new method of coloring that we are going to discuss. In this situation we did the exact opposite of what Cocos2d does by default. Instead of subtracting red and green, we added blue. Using this we can turn a black sprite any color but a white sprite will always stay white. Also using add we have to set the color to ccc3(0, 0, 0) by default instead of ccc3(255, 255, 255) or every sprite will automatically appear white. It&#8217;s quite the reverse of the cocos2d standard</li>
<li>TINT &#8211; My favorite, that took me a few headaches to figure out. We literally just turned every pixel in that sprite blue. And while, at the moment, this seems almost pointless you are missing the best part. I can turn it blue incrementally instead of completely by adding a new variable to control the amount of tinting.</li>
</ul>
<p>Here&#8217;s some tinting in increments instead of all out. This is tinting to a magenta color (<strong>[sprite setColor:ccc3(<span style="color: #ff0000;">255</span>, <span style="color: #00ff00;">0</span>, <span style="color: #0000ff;">255</span>)]</strong>).  Tint amount is set on a 0-255 scale.</p>
<p><a href="http://digitallybold.com/wp-content/uploads/2012/01/coloring2.png"><img class="alignnone size-medium wp-image-318" title="coloring2" src="http://digitallybold.com/wp-content/uploads/2012/01/coloring2-300x83.png" alt="" width="300" height="83" /></a></p>
<p>Now, if you are still not excited then this isn&#8217;t for you. Come back later when this looks like fun <img src='http://digitallybold.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h3>How does this work, exactly?</h3>
<p>It&#8217;s magic voodoo. Wait, no it&#8217;s something worse&#8230; OpenGL. I posed a question a few months back in the Cocos2d forums trying to produce the above tinting effect. What I wanted was Flash like tinting. In Flash I&#8217;ve always been able to use colorTransform and change incrementally any graphic to a color I wanted. This can be huge for games! I can make a character green if they are poisoned, red if they are burnt, flash if they are selected, the list goes on. But I couldn&#8217;t do this with Cocos2D without using at least two sprites. I even thought it was going to take two sprites no matter what I tried, I just wanted an easy solution. In the end the above effects are accomplished with one sprite, which makes me very happy.</p>
<p>So <strong><a href="http://thebackfiregames.wordpress.com/">Birkemose</a> </strong>on the Cocos2d forum pointed me in the right direction&#8230; openGL and glTexEnv. **Head explodes** Okay, okay, maybe not explode. In seriousness though, I spent the next few days breaking code repetitively searching for a solution and trying to understand with what I was dealing. Months later, I&#8217;m still not sure I fully understand <img src='http://digitallybold.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Okay so here&#8217;s the basics&#8230; we need to change up the texture  pipeline. If you want the full details of how what we are getting to experiment with works then read this, <a href="http://ofps.oreilly.com/titles/9780596804824/chadvanced.html">http://ofps.oreilly.com/titles/9780596804824/chadvanced.html</a>. I do recommend the reading; however, if you just want to get things working just follow me for now.</p>
<h3>Let&#8217;s get Additive</h3>
<p>So if you&#8217;ve used Cocos2d before you know that all our OpenGL is performed in the draw call. So we know that&#8217;s where we are going to start and, for additive sprite coloring, it&#8217;s also where we are going to end.  So if you are following along with me, you have two choices either edit CCSprite directly or subclass it and copy the draw method from CCSprite into the subclass. I named my subclass CCSpriteAdd but you can do whatever you want.</p>
<p>Here&#8217;s what the CCSprite draw method looks like:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden"style=" height: 252px;">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre>
</td>
<td class="de1">
<pre class="de1"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> draw
<span class="br0">&#123;</span>
&nbsp;
<span class="br0">&#91;</span>super draw<span class="br0">&#93;</span><span class="sy0">;</span>
&nbsp;
NSAssert<span class="br0">&#40;</span><span class="sy0">!</span>usesBatchNode_<span class="sy0">,</span> @<span class="st0">&quot;If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Unneeded states: -</span>
&nbsp;
BOOL newBlend <span class="sy0">=</span> blendFunc_.<span class="me1">src</span> <span class="sy0">!=</span> CC_BLEND_SRC <span class="sy0">||</span> blendFunc_.<span class="me1">dst</span> <span class="sy0">!=</span> CC_BLEND_DST<span class="sy0">;</span>
<span class="kw1">if</span><span class="br0">&#40;</span> newBlend <span class="br0">&#41;</span>
glBlendFunc<span class="br0">&#40;</span> blendFunc_.<span class="me1">src</span><span class="sy0">,</span> blendFunc_.<span class="me1">dst</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co2">#define kQuadSize sizeof(quad_.bl)</span>
glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw4">long</span> offset <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>quad_<span class="sy0">;</span>
&nbsp;
<span class="co1">// vertex</span>
NSInteger diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> vertices<span class="br0">&#41;</span><span class="sy0">;</span>
glVertexPointer<span class="br0">&#40;</span><span class="nu0">3</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// color</span>
&nbsp;
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> colors<span class="br0">&#41;</span><span class="sy0">;</span>
glColorPointer<span class="br0">&#40;</span><span class="nu0">4</span><span class="sy0">,</span> GL_UNSIGNED_BYTE<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// tex coords</span>
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> texCoords<span class="br0">&#41;</span><span class="sy0">;</span>
glTexCoordPointer<span class="br0">&#40;</span><span class="nu0">2</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glDrawArrays<span class="br0">&#40;</span>GL_TRIANGLE_STRIP<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> newBlend <span class="br0">&#41;</span>
glBlendFunc<span class="br0">&#40;</span>CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co2">#if CC_SPRITE_DEBUG_DRAW == 1</span>
<span class="co1">// draw bounding box</span>
CGPoint vertices<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">=</span><span class="br0">&#123;</span>
ccp<span class="br0">&#40;</span>quad_.<span class="me1">tl</span>.<span class="me1">vertices</span>.<span class="me1">x</span><span class="sy0">,</span>quad_.<span class="me1">tl</span>.<span class="me1">vertices</span>.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>quad_.<span class="me1">bl</span>.<span class="me1">vertices</span>.<span class="me1">x</span><span class="sy0">,</span>quad_.<span class="me1">bl</span>.<span class="me1">vertices</span>.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>quad_.<span class="me1">br</span>.<span class="me1">vertices</span>.<span class="me1">x</span><span class="sy0">,</span>quad_.<span class="me1">br</span>.<span class="me1">vertices</span>.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>quad_.<span class="me1">tr</span>.<span class="me1">vertices</span>.<span class="me1">x</span><span class="sy0">,</span>quad_.<span class="me1">tr</span>.<span class="me1">vertices</span>.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span>
<span class="br0">&#125;</span><span class="sy0">;</span>
&nbsp;
ccDrawPoly<span class="br0">&#40;</span>vertices<span class="sy0">,</span> <span class="nu0">4</span><span class="sy0">,</span> YES<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#elif CC_SPRITE_DEBUG_DRAW == 2</span>
<span class="co1">// draw texture box</span>
CGSize s <span class="sy0">=</span> self.<span class="me1">textureRect</span>.<span class="me1">size</span><span class="sy0">;</span>
CGPoint offsetPix <span class="sy0">=</span> self.<span class="me1">offsetPositionInPixels</span><span class="sy0">;</span>
CGPoint vertices<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span>
ccp<span class="br0">&#40;</span>offsetPix.<span class="me1">x</span><span class="sy0">,</span>offsetPix.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span> ccp<span class="br0">&#40;</span>offsetPix.<span class="me1">x</span><span class="sy0">+</span>s.<span class="me1">width</span><span class="sy0">,</span>offsetPix.<span class="me1">y</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>offsetPix.<span class="me1">x</span><span class="sy0">+</span>s.<span class="me1">width</span><span class="sy0">,</span>offsetPix.<span class="me1">y</span><span class="sy0">+</span>s.<span class="me1">height</span><span class="br0">&#41;</span><span class="sy0">,</span> ccp<span class="br0">&#40;</span>offsetPix.<span class="me1">x</span><span class="sy0">,</span>offsetPix.<span class="me1">y</span><span class="sy0">+</span>s.<span class="me1">height</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span><span class="sy0">;</span>
&nbsp;
ccDrawPoly<span class="br0">&#40;</span>vertices<span class="sy0">,</span> <span class="nu0">4</span><span class="sy0">,</span> YES<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#endif // CC_SPRITE_DEBUG_DRAW</span>
&nbsp;
<span class="br0">&#125;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">-(void) draw
{

[super draw];

NSAssert(!usesBatchNode_, @"If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");

// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Unneeded states: -

BOOL newBlend = blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST;
if( newBlend )
glBlendFunc( blendFunc_.src, blendFunc_.dst );

#define kQuadSize sizeof(quad_.bl)
glBindTexture(GL_TEXTURE_2D, [texture_ name]);

long offset = (long)&amp;quad_;

// vertex
NSInteger diff = offsetof( ccV3F_C4B_T2F, vertices);
glVertexPointer(3, GL_FLOAT, kQuadSize, (void*) (offset + diff) );

// color

diff = offsetof( ccV3F_C4B_T2F, colors);
glColorPointer(4, GL_UNSIGNED_BYTE, kQuadSize, (void*)(offset + diff));

// tex coords
diff = offsetof( ccV3F_C4B_T2F, texCoords);
glTexCoordPointer(2, GL_FLOAT, kQuadSize, (void*)(offset + diff));

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

if( newBlend )
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);

#if CC_SPRITE_DEBUG_DRAW == 1
// draw bounding box
CGPoint vertices[4]={
ccp(quad_.tl.vertices.x,quad_.tl.vertices.y),
ccp(quad_.bl.vertices.x,quad_.bl.vertices.y),
ccp(quad_.br.vertices.x,quad_.br.vertices.y),
ccp(quad_.tr.vertices.x,quad_.tr.vertices.y),
};

ccDrawPoly(vertices, 4, YES);
#elif CC_SPRITE_DEBUG_DRAW == 2
// draw texture box
CGSize s = self.textureRect.size;
CGPoint offsetPix = self.offsetPositionInPixels;
CGPoint vertices[4] = {
ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y),
ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height)
};

ccDrawPoly(vertices, 4, YES);
#endif // CC_SPRITE_DEBUG_DRAW

}</pre>
</div>
</div>
<p>Okay first of all, if you are subclassing CCSprite, remove that [super draw] call. We need to get it out of the way because we are going to write a draw function in our subclass that replaces the one in CCSprite&#8217;s draw. If you are editing CCSprite directly then you&#8217;ll just make changes to the draw call. (This isn&#8217;t about speed or future proofing but about showing how to manipulate textures. If you would like to write a class after this is over that is optimized for these things then feel free to do so.)</p>
<p>Okay find the line that reads:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
</pre>
</td>
<td class="de1">
<pre class="de1">glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glBindTexture(GL_TEXTURE_2D, [texture_ name]);</pre>
</div>
</div>
<p>and add beneath it these lines so that it reads:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
</pre>
</td>
<td class="de1">
<pre class="de1">glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> GL_SRC_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">//the magic</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_COMBINE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span> GL_ADD<span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glBindTexture(GL_TEXTURE_2D, [texture_ name]);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//the magic
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);</pre>
</div>
</div>
<p>That&#8217;s it. That&#8217;s all the magic.  You may notice an issue, I&#8217;m forcing glBlendFunc here. That&#8217;s because you are going to need to use this blend function to make it work, there may be other setups that will work as well and may work better but for my case it worked perfectly. You can pull the blendFunc line out and set it on the sprite itself if you want to but this works fine.</p>
<p>Let&#8217;s break this down:</p>
<ul>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);</strong> Okay first we set the GL_TEXTURE_ENV_MODE to GL_COMBINE so we can combine the rgbs of our texture and color. (GL_ADD produces same results)</li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD); </strong>Now when it combines RGB it adds our sprite texture and the setColor color together. So if our sprite has a texture with a pixel that has 10 blue in it and our sprites color is set to 240 then our blue when appear at 250. This occurs in all 3 channels. So in other words, every pixel&#8217;s color has the color we set our sprite added to it until it reaches 255.</li>
</ul>
<p>We&#8217;re done, except you really should do one more thing. Reset the glTexEnvi states back to default. If you don&#8217;t then every sprite rendered afterwards will go through the same process.</p>
<p>So at the very bottom of the draw method add:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
</pre>
</td>
<td class="de1">
<pre class="de1">glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span>      GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST <span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,      GL_MODULATE);
glBlendFunc( CC_BLEND_SRC, CC_BLEND_DST );</pre>
</div>
</div>
<p>That&#8217;s it. you&#8217;re draw function should look like this:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden"style=" height: 252px;">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</pre>
</td>
<td class="de1">
<pre class="de1"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> draw
&nbsp;
<span class="br0">&#123;</span>
&nbsp;
NSAssert<span class="br0">&#40;</span><span class="sy0">!</span>usesBatchNode_<span class="sy0">,</span> @<span class="st0">&quot;If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Unneeded states: -</span>
&nbsp;
BOOL newBlend <span class="sy0">=</span> NO<span class="sy0">;</span>
<span class="kw1">if</span><span class="br0">&#40;</span> blendFunc_.<span class="me1">src</span> <span class="sy0">!=</span> CC_BLEND_SRC <span class="sy0">||</span> blendFunc_.<span class="me1">dst</span> <span class="sy0">!=</span> CC_BLEND_DST <span class="br0">&#41;</span> <span class="br0">&#123;</span>
newBlend <span class="sy0">=</span> YES<span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> blendFunc_.<span class="me1">src</span><span class="sy0">,</span> blendFunc_.<span class="me1">dst</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co2">#define kQuadSize sizeof(quad_.bl)</span>
&nbsp;
glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> GL_SRC_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">//the magic</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_COMBINE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span> GL_ADD<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw4">long</span> offset <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>quad_<span class="sy0">;</span>
&nbsp;
<span class="co1">// vertex</span>
NSInteger diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> vertices<span class="br0">&#41;</span><span class="sy0">;</span>
glVertexPointer<span class="br0">&#40;</span><span class="nu0">3</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// color</span>
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> colors<span class="br0">&#41;</span><span class="sy0">;</span>
glColorPointer<span class="br0">&#40;</span><span class="nu0">4</span><span class="sy0">,</span> GL_UNSIGNED_BYTE<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// tex coords</span>
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> texCoords<span class="br0">&#41;</span><span class="sy0">;</span>
glTexCoordPointer<span class="br0">&#40;</span><span class="nu0">2</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glDrawArrays<span class="br0">&#40;</span>GL_TRIANGLE_STRIP<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> newBlend <span class="br0">&#41;</span>
glBlendFunc<span class="br0">&#40;</span>CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co2">#if CC_SPRITE_DEBUG_DRAW</span>
CGSize s <span class="sy0">=</span> <span class="br0">&#91;</span>self contentSize<span class="br0">&#93;</span><span class="sy0">;</span>
CGPoint vertices<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">=</span><span class="br0">&#123;</span>
ccp<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">,</span>ccp<span class="br0">&#40;</span>s.<span class="me1">width</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>s.<span class="me1">width</span><span class="sy0">,</span>s.<span class="me1">height</span><span class="br0">&#41;</span><span class="sy0">,</span>ccp<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span>s.<span class="me1">height</span><span class="br0">&#41;</span><span class="sy0">,</span>
<span class="br0">&#125;</span><span class="sy0">;</span>
&nbsp;
ccDrawPoly<span class="br0">&#40;</span>vertices<span class="sy0">,</span> <span class="nu0">4</span><span class="sy0">,</span> YES<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co2">#endif // CC_TEXTURENODE_DEBUG_DRAW</span>
&nbsp;
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span>      GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="br0">&#125;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">-(void) draw

{

NSAssert(!usesBatchNode_, @"If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");

// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Unneeded states: -

BOOL newBlend = NO;
if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
newBlend = YES;
glBlendFunc( blendFunc_.src, blendFunc_.dst );
}

#define kQuadSize sizeof(quad_.bl)

glBindTexture(GL_TEXTURE_2D, [texture_ name]);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//the magic
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);

long offset = (long)&amp;quad_;

// vertex
NSInteger diff = offsetof( ccV3F_C4B_T2F, vertices);
glVertexPointer(3, GL_FLOAT, kQuadSize, (void*) (offset + diff) );

// color
diff = offsetof( ccV3F_C4B_T2F, colors);
glColorPointer(4, GL_UNSIGNED_BYTE, kQuadSize, (void*)(offset + diff));

// tex coords
diff = offsetof( ccV3F_C4B_T2F, texCoords);
glTexCoordPointer(2, GL_FLOAT, kQuadSize, (void*)(offset + diff));

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

if( newBlend )
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);

#if CC_SPRITE_DEBUG_DRAW
CGSize s = [self contentSize];
CGPoint vertices[4]={
ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height),
};

ccDrawPoly(vertices, 4, YES);

#endif // CC_TEXTURENODE_DEBUG_DRAW

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,      GL_MODULATE);
glBlendFunc( CC_BLEND_SRC, CC_BLEND_DST );

}</pre>
</div>
</div>
<p>Crazy simple, huh? If you are bored play with some of the different settings for GL_COMBINE_RGB including GL_REPLACE, GL_BLEND, and GL_ADD_SIGNED. I recommend trying out GL_ADD_SIGNED in place of GL_ADD as it can produce some very useful effects as well. GL_ADD_SIGNED can be used to remove and add a color to the rendered sprite.</p>
<h3>Cocos2D Sprite Tinting: the Real Way</h3>
<p>Okay so I recommend subclassing CCSprite again and name this sprite CCSpriteClr or CCSpriteTint or whatever you prefer. Copy the draw function, remove the [super draw] call and let&#8217;s get started adding code. But before we modify draw we are going to need a new variable called colorOpacity. colorOpacity will be the amount of tint we are applying to our sprite. We will also want to have setColorOpacity and colorOpacity methods so we can access it outside the sprite. You can synthesize this but I prefer to write the methods myself incase we need to modify how they function later. So my CCSpriteClr.h reads as follows:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
</td>
<td class="de1">
<pre class="de1"><span class="co2">#import</span>
<span class="co2">#import &quot;cocos2d.h&quot;</span>
&nbsp;
@interface CCSpriteClr <span class="sy0">:</span> CCSprite <span class="br0">&#123;</span>
&nbsp;
GLubyte colorOpacity<span class="sy0">;</span>
&nbsp;
<span class="br0">&#125;</span>
&nbsp;
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>setColorOpacity<span class="sy0">:</span><span class="br0">&#40;</span>GLubyte<span class="br0">&#41;</span>o<span class="sy0">;</span>
<span class="sy0">-</span><span class="br0">&#40;</span>GLubyte<span class="br0">&#41;</span>colorOpacity<span class="sy0">;</span>
&nbsp;
@end</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">#import
#import "cocos2d.h"

@interface CCSpriteClr : CCSprite {

GLubyte colorOpacity;

}

-(void)setColorOpacity:(GLubyte)o;
-(GLubyte)colorOpacity;

@end</pre>
</div>
</div>
<p>And the added functions to CCSpriteClr.m look like this:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
</pre>
</td>
<td class="de1">
<pre class="de1"><span class="sy0">-</span><span class="br0">&#40;</span>GLubyte<span class="br0">&#41;</span>colorOpacity
<span class="br0">&#123;</span>
<span class="kw1">return</span> colorOpacity<span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> setColorOpacity<span class="sy0">:</span><span class="br0">&#40;</span>GLubyte<span class="br0">&#41;</span>o
<span class="br0">&#123;</span>
colorOpacity <span class="sy0">=</span> o<span class="sy0">;</span>
<span class="br0">&#125;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">-(GLubyte)colorOpacity
{
return colorOpacity;
}

-(void) setColorOpacity:(GLubyte)o
{
colorOpacity = o;
}</pre>
</div>
</div>
<p>Now you can call [sprite setColorOpacity:128]; to tint your sprite about 50%. Let&#8217;s jump to the draw method and start setting up our texture pipeline.</p>
<p>Like before find:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
</pre>
</td>
<td class="de1">
<pre class="de1">glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glBindTexture(GL_TEXTURE_2D, [texture_ name]);</pre>
</div>
</div>
<p>and add to it so it reads:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
</td>
<td class="de1">
<pre class="de1">glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> GL_SRC_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw4">float</span> tinting<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> color_.<span class="me1">r</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> color_.<span class="me1">g</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> color_.<span class="me1">b</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> colorOpacity<span class="sy0">/</span><span class="nu17">255.0f</span> <span class="br0">&#125;</span><span class="sy0">;</span>
glTexEnvfv<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_COLOR<span class="sy0">,</span> tinting<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_COMBINE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span>      GL_INTERPOLATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC0_RGB<span class="sy0">,</span>         GL_TEXTURE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC1_RGB<span class="sy0">,</span>         GL_CONSTANT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC2_RGB<span class="sy0">,</span>         GL_CONSTANT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND2_RGB<span class="sy0">,</span>   GL_ONE_MINUS_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_ALPHA<span class="sy0">,</span> GL_SUBTRACT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND1_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glBindTexture(GL_TEXTURE_2D, [texture_ name]);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
float tinting[4] = { color_.r/255.0f, color_.g/255.0f, color_.b/255.0f, colorOpacity/255.0f };
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, tinting);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,      GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB,         GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB,         GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB,         GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB,   GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_SUBTRACT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_ONE_MINUS_SRC_ALPHA);</pre>
</div>
</div>
<p>Wow, that&#8217;s a lot more code than before and it can be pretty confusing. There&#8217;s a lot of math involved and rather than explain it in detail allow me to simply touch on what is going on here.</p>
<ul>
<li><strong>float tinting[4] = { color_.r/255.0f, color_.g/255.0f, color_.b/255.0f, colorOpacity/255.0f };</strong> Here we are taking the color we set with setColor and mixing our colorOpacity in with it.</li>
<li><strong>glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, tinting);</strong> We are setting the color that we will combine with our texture. The color of course being drawn from the tinting variable we created in the line before.</li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,      GL_INTERPOLATE);</strong> This thing (GL_INTERPOLATE) combines three separate sources to create our final product using this math: <em>OutputColor = Arg0 ∗ Arg2 + Arg1 ∗ (1 − Arg2)</em></li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB,         GL_TEXTURE); </strong>This is the first source which is our sprite texture.<em><br />
</em></li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB,         GL_CONSTANT); glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB,         GL_CONSTANT); </strong>The second and third source are the same (GL_CONSTANT).  GL_CONSTANT refers to our GL_TEXTURE_ENV_COLOR that we set a few lines before.</li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB,   GL_ONE_MINUS_SRC_ALPHA); </strong>We change the way we want  the third source  to mix with the others.</li>
<li><strong>glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_SUBTRACT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_ONE_MINUS_SRC_ALPHA); </strong>Change the way the alpha combines.</li>
</ul>
<p>If you want to understand the math behind what is going on above then you can get all the information you need here: <a href="http://ofps.oreilly.com/titles/9780596804824/chadvanced.html">http://ofps.oreilly.com/titles/9780596804824/chadvanced.html</a></p>
<p>A much better person than I has explained how each of these different settings work at the above link. Using it you can probably create all kinds of cool effects.  But before we get off track we need to do one more thing, reset all our settings. So at the end of your draw function add this:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
</pre>
</td>
<td class="de1">
<pre class="de1">glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC1_RGB<span class="sy0">,</span> GL_PREVIOUS<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_ALPHA<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND1_ALPHA<span class="sy0">,</span> GL_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glBlendFunc<span class="br0">&#40;</span> CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST <span class="br0">&#41;</span><span class="sy0">;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);

glBlendFunc( CC_BLEND_SRC, CC_BLEND_DST );</pre>
</div>
</div>
<p>And your full draw function should look something like this:</p>
<style type="text/css">
.bwp-syntax-wrapper li {white-space: normal;}
</style>
<div class="bwp-syntax-block clearfix bwp-syntax-has-border">
<div class="bwp-syntax-block-handle" style="height: 16.8px;"><a href="javascript:;" title="Click to toggle codeblock">Click to toggle codeblock</a></div>
<div class="bwp-syntax-toolbar">
<div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div>
</div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple bwp-syntax-hidden"style=" height: 252px;">
<table class="c">
<tbody>
<tr class="li1">
<td class="ln">
<pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
</pre>
</td>
<td class="de1">
<pre class="de1"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> draw
<span class="br0">&#123;</span>
NSAssert<span class="br0">&#40;</span><span class="sy0">!</span>usesBatchNode_<span class="sy0">,</span> @<span class="st0">&quot;If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY</span>
<span class="co1">// Unneeded states: -</span>
&nbsp;
BOOL newBlend <span class="sy0">=</span> NO<span class="sy0">;</span>
<span class="kw1">if</span><span class="br0">&#40;</span> blendFunc_.<span class="me1">src</span> <span class="sy0">!=</span> CC_BLEND_SRC <span class="sy0">||</span> blendFunc_.<span class="me1">dst</span> <span class="sy0">!=</span> CC_BLEND_DST <span class="br0">&#41;</span> <span class="br0">&#123;</span>
newBlend <span class="sy0">=</span> YES<span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> blendFunc_.<span class="me1">src</span><span class="sy0">,</span> blendFunc_.<span class="me1">dst</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co2">#define kQuadSize sizeof(quad_.bl)</span>
&nbsp;
glBindTexture<span class="br0">&#40;</span>GL_TEXTURE_2D<span class="sy0">,</span> <span class="br0">&#91;</span>texture_ name<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
glBlendFunc<span class="br0">&#40;</span> GL_SRC_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw4">float</span> tinting<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> color_.<span class="me1">r</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> color_.<span class="me1">g</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> color_.<span class="me1">b</span><span class="sy0">/</span><span class="nu17">255.0f</span><span class="sy0">,</span> colorOpacity<span class="sy0">/</span><span class="nu17">255.0f</span> <span class="br0">&#125;</span><span class="sy0">;</span>
glTexEnvfv<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_COLOR<span class="sy0">,</span> tinting<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_COMBINE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span> GL_INTERPOLATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC0_RGB<span class="sy0">,</span> GL_TEXTURE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC1_RGB<span class="sy0">,</span> GL_CONSTANT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC2_RGB<span class="sy0">,</span> GL_CONSTANT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND2_RGB<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_ALPHA<span class="sy0">,</span> GL_SUBTRACT<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND1_ALPHA<span class="sy0">,</span> GL_ONE_MINUS_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw4">long</span> offset <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>quad_<span class="sy0">;</span>
&nbsp;
<span class="co1">// vertex</span>
NSInteger diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> vertices<span class="br0">&#41;</span><span class="sy0">;</span>
glVertexPointer<span class="br0">&#40;</span><span class="nu0">3</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// color</span>
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> colors<span class="br0">&#41;</span><span class="sy0">;</span>
glColorPointer<span class="br0">&#40;</span><span class="nu0">4</span><span class="sy0">,</span> GL_UNSIGNED_BYTE<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// tex coords</span>
diff <span class="sy0">=</span> offsetof<span class="br0">&#40;</span> ccV3F_C4B_T2F<span class="sy0">,</span> texCoords<span class="br0">&#41;</span><span class="sy0">;</span>
glTexCoordPointer<span class="br0">&#40;</span><span class="nu0">2</span><span class="sy0">,</span> GL_FLOAT<span class="sy0">,</span> kQuadSize<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>offset <span class="sy0">+</span> diff<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glDrawArrays<span class="br0">&#40;</span>GL_TRIANGLE_STRIP<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> newBlend <span class="br0">&#41;</span>
glBlendFunc<span class="br0">&#40;</span>CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co2">#if CC_SPRITE_DEBUG_DRAW</span>
CGSize s <span class="sy0">=</span> <span class="br0">&#91;</span>self contentSize<span class="br0">&#93;</span><span class="sy0">;</span>
CGPoint vertices<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">=</span><span class="br0">&#123;</span>
ccp<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">,</span>ccp<span class="br0">&#40;</span>s.<span class="me1">width</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">,</span>
ccp<span class="br0">&#40;</span>s.<span class="me1">width</span><span class="sy0">,</span>s.<span class="me1">height</span><span class="br0">&#41;</span><span class="sy0">,</span>ccp<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span>s.<span class="me1">height</span><span class="br0">&#41;</span><span class="sy0">,</span>
<span class="br0">&#125;</span><span class="sy0">;</span>
ccDrawPoly<span class="br0">&#40;</span>vertices<span class="sy0">,</span> <span class="nu0">4</span><span class="sy0">,</span> YES<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co2">#endif // CC_TEXTURENODE_DEBUG_DRAW</span>
&nbsp;
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_TEXTURE_ENV_MODE<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_RGB<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_SRC1_RGB<span class="sy0">,</span> GL_PREVIOUS<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_COMBINE_ALPHA<span class="sy0">,</span> GL_MODULATE<span class="br0">&#41;</span><span class="sy0">;</span>
glTexEnvi<span class="br0">&#40;</span>GL_TEXTURE_ENV<span class="sy0">,</span> GL_OPERAND1_ALPHA<span class="sy0">,</span> GL_SRC_ALPHA<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
glBlendFunc<span class="br0">&#40;</span> CC_BLEND_SRC<span class="sy0">,</span> CC_BLEND_DST <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="br0">&#125;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bwp-syntax-source">
<pre class="no-parse">-(void) draw
{
NSAssert(!usesBatchNode_, @"If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");

// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// Unneeded states: -

BOOL newBlend = NO;
if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
newBlend = YES;
glBlendFunc( blendFunc_.src, blendFunc_.dst );
}

#define kQuadSize sizeof(quad_.bl)

glBindTexture(GL_TEXTURE_2D, [texture_ name]);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

float tinting[4] = { color_.r/255.0f, color_.g/255.0f, color_.b/255.0f, colorOpacity/255.0f };
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, tinting);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_SUBTRACT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

long offset = (long)&amp;quad_;

// vertex
NSInteger diff = offsetof( ccV3F_C4B_T2F, vertices);
glVertexPointer(3, GL_FLOAT, kQuadSize, (void*) (offset + diff) );

// color
diff = offsetof( ccV3F_C4B_T2F, colors);
glColorPointer(4, GL_UNSIGNED_BYTE, kQuadSize, (void*)(offset + diff));

// tex coords
diff = offsetof( ccV3F_C4B_T2F, texCoords);
glTexCoordPointer(2, GL_FLOAT, kQuadSize, (void*)(offset + diff));

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

if( newBlend )
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);

#if CC_SPRITE_DEBUG_DRAW
CGSize s = [self contentSize];
CGPoint vertices[4]={
ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height),
};
ccDrawPoly(vertices, 4, YES);
#endif // CC_TEXTURENODE_DEBUG_DRAW

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);

glBlendFunc( CC_BLEND_SRC, CC_BLEND_DST );

}</pre>
</div>
</div>
<p>There you go! You should be set to tint and add color to sprites!</p>
<h3>Taking Sprite Coloring to a Whole New Level</h3>
<p>Okay so first of all, you may want to optimize this a bit. Maybe you want to set it up so that you have one sprite subclass that can jump between multiple modes and do additive and tinting both in the same sprite. Maybe you want to move this up so it works in batch nodes as well (If that&#8217;s the case, look at the CCTextureAtlas). Maybe you just want to play around and see what you can create, I recommend this <img src='http://digitallybold.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  I&#8217;d love to see a &#8220;cookbook&#8221; of different ways you can change the pipeline to do a variety of effects. If you create something new then please post it in the comments! Before we go here&#8217;s the source code if you want to download it:</p>
<div class="message_karma_coolblue colored_box"><p style="font-size:13px;">

Download Source Code:

<a href="http://digitallybold.com/wp-content/uploads/2012/01/colortest.zip" class="ka_button small_button small_limegreen" target="_self"><span>Cocos2d CCSprite Coloring Source Code</span></a>

</p></div><br class="clear" />]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/314/cocos2d-additive-sprite-color-tinting/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>TDRPG Project Faery gets Upgraded</title>
		<link>http://digitallybold.com/307/tdrpg-project-faery-gets-upgraded</link>
		<comments>http://digitallybold.com/307/tdrpg-project-faery-gets-upgraded#comments</comments>
		<pubDate>Fri, 30 Dec 2011 17:33:17 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=307</guid>
		<description><![CDATA[What do I mean by TDRPG, you ask? And what do I mean by upgraded... this game isn't even out yet. Right?]]></description>
			<content:encoded><![CDATA[<p>What do I mean by TDRPG, you ask? And what do I mean by upgraded&#8230; this game isn&#8217;t even out yet.</p>
<p>Well first of all by TDRPG we are talking about Tower Defense Role Playing Game. And this may be a stretch of the imagination to really call this game an RPG it undoubtably is going to be dazzled with RPG elements. We&#8217;re talking 20% RPG and 80% TD. After all you are running around as cute little forest characters trying to save the day from external evil forces. If that&#8217;s not RPG then what is?</p>
<p>Building on the RPG direction you can&#8217;t forget upgrades. What RPG doesn&#8217;t allow you to upgrade your characters abilities and improve your chances against your foes. It&#8217;s all about getting stronger and taking down enemies with ease that you once fell over dead in their proximity. Based on your skill in defending a battle you&#8217;re awarded &#8220;stars&#8221; that will allow you to upgrade your characters and improve your odds in the levels to come.</p>
<p>So what&#8217;s this upgrade system look like? Check out the screen shot below.</p>
<div class="modern_img_frame modern_two_col_large"> <div class="modern_preload_two_col_large preload"><a href="http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot4.png" class="attachment-fadeIn" data-gal="prettyPhoto[pg_1]" title="digitally bold project faery upgrade system"><img src="http://digitallybold.com/wp-content/themes/Karma/images/_global/img-zoom-2.png" style="position:absolute; display: none;" alt="digitally bold project faery upgrade system" /><img src='http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot4-437x234.png' alt='digitally bold project faery upgrade system' /></a></div></div><p>Okay, so let me elaborate a bit. To the left is the side bar that keeps you updated on what ability you have selected and gives you the opportunity to unlock it if eligible. To gain an ability it must be connected to another unlocked ability and you must have the required stars available to complete the unlock. It&#8217;s a simple system really, but the beauty is in deciding which paths to take in order to unlock the needed abilities. In the screenshot above there are 93 upgrades (of course, you can only see about 17 of them) available; however, I&#8217;m in the process of adding another 36 to each character.</p>
<p>Ultimately, I think this feature will really add a new level of depth to how to play the game. Not only do you need to choose the correct tower combinations to defend properly but you&#8217;ll need to upgrade your character in order to be successful.</p>
<div class="poll" id="poll-3">
<p class="question">What do you think of the Upgrade System?</p>
<form method="post" action="http://digitallybold.com/wp-content/plugins/simply-poll/page/user/poll-submit.php">
<input type="hidden" name="poll" value="3" />
<input type="hidden" name="backurl" value="digitallybold.com/feed" />
<fieldset>
<ul>
<li>
<input type="radio" name="answer" value="1" id="poll-3-1" />
						<label for="poll-3-1">Yes! This is going to make the game even better!</label>
					</li>
<li>
<input type="radio" name="answer" value="2" id="poll-3-2" />
						<label for="poll-3-2">Boo! I want my Tower Defense simple.</label>
					</li>
</ul>
</fieldset>
<p><button>Vote</button></p>
</p></form>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/307/tdrpg-project-faery-gets-upgraded/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Faery and The Grass Tower</title>
		<link>http://digitallybold.com/299/project-faery-and-the-grass-tower</link>
		<comments>http://digitallybold.com/299/project-faery-and-the-grass-tower#comments</comments>
		<pubDate>Sat, 17 Dec 2011 15:39:17 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=299</guid>
		<description><![CDATA[A little development talk<br />
The most difficult thing about this project has been really nailing things down. Without a doubt, this has become an incredible learning experience. Work on this project was started about a year ago. Of course, as I write this article now I&#8217;m remembering one year ago (practically to the day) writing a prototype for GooMonsters and watch little solid colored circles chase a block around the screen. GooMonsters was an intentional derailment from this game, mostly ...]]></description>
			<content:encoded><![CDATA[<h3>A little development talk</h3>
<p>The most difficult thing about this project has been really nailing things down. Without a doubt, this has become an incredible learning experience. Work on this project was started about a year ago. Of course, as I write this article now I&#8217;m remembering one year ago (practically to the day) writing a prototype for GooMonsters and watch little solid colored circles chase a block around the screen. GooMonsters was an intentional derailment from this game, mostly because I&#8217;ve found making decisions on how to address aspects of the game to be incredibly difficult. This game has depth at a level that nothing I&#8217;ve developed in the past could have, probably because strategy is a <strong>huge</strong> key. Figuring out how to balance the game and incorporate a sense of achievement has always haunted me. I have multiple pages full of numbers and organized thoughts trying to pinpoint how this game is going to work, flow, and balance. And while I will be balancing until right before the game is released I definitely think it&#8217;s coming together.</p>
<p>The past two weeks have been huge. Two of the biggest mental hurdles I was cowering behind finally came down. Mostly because forcing a decision and going at it full force produced results. Hurdle 1) Get the Faeries in game and working. Hurdle 2) Make this game a TDRPG not just another TD game.</p>
<p>Since the beginning I knew one thing about this game was certain, I wanted a story. I think back to the first Digitally Bold release, Fly Away Rabbit, and am saddened I didn&#8217;t give that poor rabbit a good solid reason for flying into the clouds. I know that game could have been twice as successful if I had cultivated a desire in the player to see this rabbit succeed. But I digress, Project Faery needed a story because I want this TD game to feel like you have a purpose for helping these forest guardians save the day. And I wanted the levels to progress ultimately to a final goal. It&#8217;s TD but with a purpose.</p>
<p>So all that said, RPG elements just make sense. Why not be able to upgrade as you progress through levels. Who doesn&#8217;t like upgrades? After all there&#8217;s a popular flash game <a title="Upgrade Complete" href="http://www.kongregate.com/games/ArmorGames/upgrade-complete?acomplete=upgrade+complete" target="_blank">Upgrade Complete</a> where you quite literally upgrade everything. So while upgrading has always been a goal, how to do it has been a complete mess of ideas that went from blatantly simple to so complex my head hurts thinking about programming it. At the moment I&#8217;ve happily stuck with blatantly simple for the user and just mildly complex programmatically.  Also at the moment, I love the upgrade system, I can&#8217;t wait to show off some examples as it gets more fully developed, but for now know it&#8217;s a definitely inspired by some of the Final Fantasies.</p>
<h3>The Grass Tower</h3>
<div class="modern_img_frame modern_two_col_large"> <div class="modern_preload_two_col_large preload"><a href="http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot3.png" class="attachment-fadeIn" data-gal="prettyPhoto[pg_1]" title=""><img src="http://digitallybold.com/wp-content/themes/Karma/images/_global/img-zoom-2.png" style="position:absolute; display: none;" alt="" /><img src='http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot3-437x234.png' alt='' /></a></div></div><p>This was the first tower designed for the game. While its function has took some overhauls in recent days due to its naturally tesla looking shape (becoming a lightning tower), it&#8217;s still a fundamental tower in the game. This tower works fantastic for weakening (and taking out) unarmored enemies due to it&#8217;s fast reload and wide spread attack. Above you can see it attacking a &#8220;Goober&#8221; with both a damage and burn enhancement added to the tower.  Many enhancements such as burn, will effect the target over time resulting in color tinting. This lets you track what attacks are currently affecting your enemies.  <em>[A little development note on tinting: this is an effect I was able to achieve using just OpenGLES that I will write a blog post on later. If you want some details now be sure to check out <a title="Additive Coloring Solutions" href="http://www.cocos2d-iphone.org/forum/topic/20487/page/2" target="_blank">this thread</a>]</em></p>
<p>If you like Digitally Bold please <a title="Digitally Bold Twitter" href="http://twitter.com/digibold" target="_blank">follow us</a> on Twitter so we can keep you up to date on what&#8217;s happening <img src='http://digitallybold.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/299/project-faery-and-the-grass-tower/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tower Defense Project Faery Update #2</title>
		<link>http://digitallybold.com/292/tower-defense-project-faery-update-2</link>
		<comments>http://digitallybold.com/292/tower-defense-project-faery-update-2#comments</comments>
		<pubDate>Thu, 08 Dec 2011 16:57:19 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=292</guid>
		<description><![CDATA[Time for a weekly update on the upcoming Digitally Bold release. For now we&#8217;re going to call it by a codename Project Faery until a official name is released. So here&#8217;s our screenshot for this week.<br />
Building on last week&#8217;s screenshot you can see we still have our trusty forest friend the fox as the player character. Likewise we are showing a newly created menu. The Faery HUD let&#8217;s you select a faery to assist you in defending. (We&#8217;ll reveal ...]]></description>
			<content:encoded><![CDATA[<p>Time for a weekly update on the upcoming Digitally Bold release. For now we&#8217;re going to call it by a codename Project Faery until a official name is released. So here&#8217;s our screenshot for this week.</p>
<div class="modern_img_frame modern_two_col_large"> <div class="modern_preload_two_col_large preload"><a href="http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot2.png" class="attachment-fadeIn" data-gal="prettyPhoto[pg_1]" title=""><img src="http://digitallybold.com/wp-content/themes/Karma/images/_global/img-zoom-2.png" style="position:absolute; display: none;" alt="" /><img src='http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot2-437x234.png' alt='' /></a></div></div><p>Building on last week&#8217;s screenshot you can see we still have our trusty forest friend the fox as the player character. Likewise we are showing a newly created menu. The Faery HUD let&#8217;s you select a faery to assist you in defending. (We&#8217;ll reveal what you are defending later but know that it&#8217;s a slightly different twist on defending than in other TD games)  Each of the 5 faeries has a different ability that it can perform to either attack and enemy, enhance your defenses, or assist the player character. We&#8217;ll talk about this more in detail in the future. For now enjoy the sneak peak.</p>
<p>Also you will notice a pink/red creature moving in the bottom left of the screen. If you are Digitally Bold fan you&#8217;ll no doubt have seen &#8220;Goober&#8221; before in our previous game GooMonsters home screen. Goober was the first enemy created for the this upcoming TD project and as an easter egg was introduced in GooMonsters. Goober is one of the weakest land based enemies in Project Faery and has no special abilities. It&#8217;s the most basic of the basic mobs.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/292/tower-defense-project-faery-update-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Our New Project Teaser</title>
		<link>http://digitallybold.com/282/our-new-project-teaser</link>
		<comments>http://digitallybold.com/282/our-new-project-teaser#comments</comments>
		<pubDate>Thu, 01 Dec 2011 17:36:02 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=282</guid>
		<description><![CDATA[I'm kicking into gear on the new Digitally Bold project. Currently I'm not releasing any major details because well, they're not finalized yet but I can tell you this...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m kicking into gear on the new Digitally Bold project. Currently I&#8217;m not releasing any major details because well, they&#8217;re not finalized yet but I can tell you this:</p>
<ul class="list list2">
<li>It&#8217;s a Tower Defense Game.</li>
<li>It&#8217;s in the style of a top-down RPG (RPG elements may be included in gameplay).</li>
<li>You play as one of many characters.</li>
</ul>
<p>Here&#8217;s a screenshot of the game currently. You can get a really good feel for the art style and one of the playable characters. Likewise you are looking at one of the tower building screens. Currently there&#8217;s planned 4 to 5 towers. We&#8217;ll talk more about that later but let&#8217;s just say it&#8217;s 4 or 5 towers each with nearly infinite upgrade possibilities.</p>
<div class="modern_img_frame modern_two_col_large"> <div class="modern_preload_two_col_large preload"><a href="http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot1.png" class="attachment-fadeIn" data-gal="prettyPhoto[pg_1]" title="First public screenshot of new Digitally Bold project"><img src="http://digitallybold.com/wp-content/themes/Karma/images/_global/img-zoom-2.png" style="position:absolute; display: none;" alt="First public screenshot of new Digitally Bold project" /><img src='http://digitallybold.com/wp-content/uploads/2011/12/fae-screenshot1-437x234.png' alt='First public screenshot of new Digitally Bold project' /></a></div></div><p>This is a new style of development at Digitally Bold, typically we keep things secret until release but this time around we really want your help building this game. Your opinions on TD games and what would make a great one definitely is in our consideration. So here&#8217;s our first poll question.</p>
<div class="poll" id="poll-2">
<p class="question">What do you like best about TD games?</p>
<form method="post" action="http://digitallybold.com/wp-content/plugins/simply-poll/page/user/poll-submit.php">
<input type="hidden" name="poll" value="2" />
<input type="hidden" name="backurl" value="digitallybold.com/feed" />
<fieldset>
<ul>
<li>
<input type="radio" name="answer" value="1" id="poll-2-1" />
						<label for="poll-2-1">The strategy</label>
					</li>
<li>
<input type="radio" name="answer" value="2" id="poll-2-2" />
						<label for="poll-2-2">Making powerful towers</label>
					</li>
<li>
<input type="radio" name="answer" value="3" id="poll-2-3" />
						<label for="poll-2-3">destroying wave after wave of enemies</label>
					</li>
</ul>
</fieldset>
<p><button>Vote</button></p>
</p></form>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/282/our-new-project-teaser/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GooMonsters gets Joysticks</title>
		<link>http://digitallybold.com/148/goomonsters-gets-joysticks</link>
		<comments>http://digitallybold.com/148/goomonsters-gets-joysticks#comments</comments>
		<pubDate>Wed, 31 Aug 2011 13:36:38 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=148</guid>
		<description><![CDATA[While GooMonsters was made for tilt, tilt and more tilt, we&#8217;ve buckled and gave fans the opportunity to play the game in joystick mode instead. In GooMonsters 1.1 we&#8217;ve added a lot to making sure you can control the game the way you want to. Tilt controls now have the ability to adjust horizontal and vertical sensitivity as desired. This is useful depending on how you like to hold your iDevice.<br />
The joystick controls now allow for you to play ...]]></description>
			<content:encoded><![CDATA[<p>While GooMonsters was made for tilt, tilt and more tilt, we&#8217;ve buckled and gave fans the opportunity to play the game in joystick mode instead. In GooMonsters 1.1 we&#8217;ve added a lot to making sure you can control the game the way you want to. Tilt controls now have the ability to adjust horizontal and vertical sensitivity as desired. This is useful depending on how you like to hold your iDevice.</p>
<p>The joystick controls now allow for you to play two ways. The two joystick modes are Solo Stick and Dual Stick. Solo stick gives you one joystick that controls the character movement. Swinging is completed the same way as in tilt mode, you swing in the direction your character is moving.<br />
Dual stick has a two joystick interface. One is for movement like Solo stick, the other is for swinging. The swing joystick is used by putting your finger in the center and swiping out in the direction you want to attack. So if an enemy is below your character then put your finger in the center of the stick and swipe downward.</p>
<p>Hopefully now every fan of action and adventure games can really enjoy the gameplay of GooMonsters. Go Hack, Slash, and Splatter!</p>
<div id="attachment_149" class="wp-caption alignnone" style="width: 310px"><a href="http://digitallybold.com/wp-content/uploads/2011/08/joystick1.png"><img class="size-medium wp-image-149" title="joystick1" src="http://digitallybold.com/wp-content/uploads/2011/08/joystick1-300x200.png" alt="GooMonsters Solo Stick" width="300" height="200" /></a>
<p class="wp-caption-text">Solo stick interface</p>
</div>
<div id="attachment_150" class="wp-caption alignnone" style="width: 310px"><a href="http://digitallybold.com/wp-content/uploads/2011/08/joystick2.png"><img class="size-medium wp-image-150" title="joystick2" src="http://digitallybold.com/wp-content/uploads/2011/08/joystick2-300x200.png" alt="GooMonsters Dual Stick Mode" width="300" height="200" /></a>
<p class="wp-caption-text">Dual Stick interface</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/148/goomonsters-gets-joysticks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GooMonsters hits the AppStore</title>
		<link>http://digitallybold.com/129/goomonsters-hits-the-appstore</link>
		<comments>http://digitallybold.com/129/goomonsters-hits-the-appstore#comments</comments>
		<pubDate>Wed, 17 Aug 2011 14:36:36 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=129</guid>
		<description><![CDATA[It&#8217;s official, GooMonsters is now available in the app store. At $0.99, Goo Monsters is an incredible deal. With 58 achievements and 13 leaderboards you&#8217;ll have a lot to achieve besides simply completely the thousands of goo splattering campaign. If you are ready to play, just head over to the app store now and download your copy of GooMonsters! Get excited, it&#8217;s a fun one.<br />
GooMonsters iTunes Link<br />
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s official, GooMonsters is now available in the app store. At $0.99, Goo Monsters is an incredible deal. With 58 achievements and 13 leaderboards you&#8217;ll have a lot to achieve besides simply completely the thousands of goo splattering campaign. If you are ready to play, just head over to the app store now and download your copy of GooMonsters! Get excited, it&#8217;s a fun one.</p>
<p><a href="http://toucharcade.com/link/http://itunes.apple.com/app/goomonsters/id432923253?mt=8">GooMonsters iTunes Link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/129/goomonsters-hits-the-appstore/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GooMonsters Off to AppStore!</title>
		<link>http://digitallybold.com/1/goomonsters-iphone-game-appstore</link>
		<comments>http://digitallybold.com/1/goomonsters-iphone-game-appstore#comments</comments>
		<pubDate>Mon, 20 Jun 2011 17:38:50 +0000</pubDate>
		<dc:creator>Par</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://digitallybold.com/?p=1</guid>
		<description><![CDATA[Alright!!! A simple project that started development during Christmas of 2010 is finally off to the Appstore. GooMonsters started as an idea for a quick game that draws influence from great avoidance games like Tilt to Live. Using Tilt to Live style controls GooMonsters, is a great game to show off the beauty and power of the iPhone&#8217;s accelerometer.<br />
So what&#8217;s the big idea? Well here it is. Zombie games are all the rage&#8230; and well&#8230; for good reason. But ...]]></description>
			<content:encoded><![CDATA[<p>Alright!!! A simple project that started development during Christmas of 2010 is finally off to the Appstore. GooMonsters started as an idea for a quick game that draws influence from great avoidance games like Tilt to Live. Using Tilt to Live style controls GooMonsters, is a great game to show off the beauty and power of the iPhone&#8217;s accelerometer.</p>
<p>So what&#8217;s the big idea? Well here it is. Zombie games are all the rage&#8230; and well&#8230; for good reason. But they&#8217;re typically dark, moody, and bloody. Well, I don&#8217;t mind the light hints at blood but I wanted a game with some color and vibrance. GooMonsters is all about splattering bright color all over the screen. It leaves the game with a more casual feel and all the fun cartoon &#8220;gore&#8221;.</p>
<p>The majority of graphics and programming for GooMonsters was completed in early March. The goal was the end of February but&#8230; missed it by that much. From that time the game went into beta testing and sound development. Digitally Bold brought in <a href="http://www.whitakerblackall.com/">Whitaker Blackall</a>, sound designer for games like Tilt to Live, Casey&#8217;s Contraption, Velocispider, and now GooMonsters.  Sound design and beta testing went from March to August.</p>
<p>Now GooMonsters is officially on it&#8217;s way to the AppStore. Look to see it out soon. Head over to the <a title="GooMonsters" href="http://digitallybold.com/games/goomonsters">GooMonsters page</a> to see the video trailer and screenshots.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://digitallybold.com/1/goomonsters-iphone-game-appstore/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

