<?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>cocos2d for iPhone</title>
	<atom:link href="http://www.cocos2d-iphone.org/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cocos2d-iphone.org</link>
	<description>A 2d game engine for iPhone / iPad that&#039;s fast, easy to use, free, and community supported</description>
	<lastBuildDate>Wed, 17 Mar 2010 22:02:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Assorted cocos2d games</title>
		<link>http://www.cocos2d-iphone.org/archives/723</link>
		<comments>http://www.cocos2d-iphone.org/archives/723#comments</comments>
		<pubDate>Wed, 17 Mar 2010 18:24:42 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=723</guid>
		<description><![CDATA[If you were wondering what kind of games you could make with cocos2d, here is a summary of recently released cocos2d games:
Zombie Games


ZombieSmash $1.99
Zombie Farm  $Free

Flying Hero Games


The Hero $1.99
Super Turbo Action Pig $0.99

Shooter Games


AbstractWar 2.0 $0.99
Sniper Strike $Free

Racing Games


Doodle Kart $0.99
Doodle Kart Lite $Free
Sprint Racers GP $Free (link will be added soon)

Puzzle Games


Tiki Totems [...]]]></description>
			<content:encoded><![CDATA[<p>If you were wondering what kind of games you could make with cocos2d, here is a summary of recently released cocos2d games:</p>
<h3>Zombie Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zombiesmash.jpg"><img class="size-medium wp-image-736" title="zombiesmash" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zombiesmash-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zombiefarm.jpg"><img class="size-medium wp-image-735" title="zombiefarm" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zombiefarm-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/zombiesmash/id349095099?mt=8">ZombieSmash $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/zombie-farm/id339933022?mt=8">Zombie Farm  $Free</a></li>
</ul>
<h3>Flying Hero Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/the-hero.jpg"><img class="alignnone size-medium wp-image-732" title="the-hero" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/the-hero-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/super-turbo-action-pig.jpg"><img class="alignnone size-medium wp-image-731" title="super-turbo-action-pig" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/super-turbo-action-pig-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/the-hero/id347549741?mt=8">The Hero $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/super-turbo-action-pig/id360371122?mt=8">Super Turbo Action Pig $0.99</a></li>
</ul>
<h3>Shooter Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/abstract-war.jpg"><img class="alignnone size-medium wp-image-724" title="abstract-war" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/abstract-war-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sniper-strike.jpg"><img class="alignnone size-medium wp-image-728" title="sniper-strike" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sniper-strike-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/abstractwar-2-0/id356167684?mt=8">AbstractWar 2.0 $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/sniper-strike/id338209245?mt=8">Sniper Strike $Free</a></li>
</ul>
<h3>Racing Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/doodle-kart.jpg"><img class="alignnone size-medium wp-image-727" title="doodle-kart" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/doodle-kart-200x300.jpg" alt="" width="200" height="300" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sprint-racers-gp-screenshot.jpg"><img class="alignnone size-medium wp-image-740" title="sprint-racers-gp-screenshot" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sprint-racers-gp-screenshot-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/doodle-kart/id360564992?mt=8">Doodle Kart $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/doodle-kart-lite/id360565434?mt=8">Doodle Kart Lite $Free</a></li>
<li>Sprint Racers GP $Free (link will be added soon)</li>
</ul>
<h3>Puzzle Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/tiki-totems.jpg"><img class="alignnone size-medium wp-image-733" title="tiki-totems" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/tiki-totems-200x300.jpg" alt="" width="200" height="300" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/blockoban.jpg"><img class="alignnone size-medium wp-image-725" title="blockoban" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/blockoban-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/tiki-totems/id336926063?mt=8">Tiki Totems $Free</a></li>
<li><a href="http://itunes.apple.com/us/app/tiki-totems-premium/id360807592?mt=8">Tiki Totems Premium $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/blockoban/id339973334?mt=8">Blockoban $Free</a></li>
<li><a href="http://itunes.apple.com/us/app/blockoban-premium/id352635498?mt=8">Blockoban Premium $2.99</a></li>
</ul>
<h3>Strategy Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/space-harvest.jpg"><img class="alignnone size-medium wp-image-729" title="space-harvest" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/space-harvest-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/kretures.jpg"><img class="alignnone size-medium wp-image-752" title="kretures" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/kretures-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/space-harvest/id348795059?mt=8">Space Harvest $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/kretures/id351632067?mt=8">Kretures $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/kretures-lite/id361829979?mt=8">Kretures Lite $Free</a></li>
</ul>
<h3>Artistic Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/trundle.jpg"><img class="alignnone size-medium wp-image-734" title="trundle" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/trundle-300x200.jpg" alt="" width="300" height="200" /></a><a href="../wp-content/uploads/2010/03/pixel-pile.jpg"><img title="pixel-pile" src="../wp-content/uploads/2010/03/pixel-pile-200x300.jpg" alt="" width="200" height="300" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/forest-folk1.jpg"><img class="alignnone size-medium wp-image-747" title="forest-folk" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/forest-folk1-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zwirn.jpg"><img class="alignnone size-medium wp-image-737" title="zwirn" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zwirn-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/trundle/id339003342?mt=8">Trundle $Free</a></li>
<li><a href="http://itunes.apple.com/us/app/pixel-pile/id349146093?mt=8">Pixel Pile $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/forest-folk/id339869450?mt=8">Forest Folk $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/zwirn/id344807871?mt=8">Zwirn   $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/zwirn-lite/id358276188?mt=8">Zwirn   Lite $Free</a></li>
</ul>
<h3>Doodle/Stick Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/doodle-blast.jpg"><img class="alignnone size-medium wp-image-726" title="doodle-blast" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/doodle-blast-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/stick-sports.jpg"><img class="alignnone size-medium wp-image-730" title="stick-sports" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/stick-sports-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/doodle-blast/id358522399?mt=8">Doodle Blast $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/stick-sports-summer-games/id359627647?mt=8">Stick Sports: Summer Games $1.99</a></li>
<li><a href="http://itunes.apple.com/us/app/stick-sports-summer-games/id359632759?mt=8">Stick Sports: Summer Games Lite $Free</a></li>
</ul>
<h3>Kids Games</h3>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zoo-lasso.jpg"><img class="alignnone size-medium wp-image-745" title="zoo-lasso" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/zoo-lasso-300x200.jpg" alt="" width="300" height="200" /></a><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/monkey-preschool-lunchbox.jpg"><img class="alignnone size-medium wp-image-744" title="monkey-preschool-lunchbox" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/monkey-preschool-lunchbox-300x200.jpg" alt="" width="300" height="200" /></a></p>
<ul>
<li><a href="http://itunes.apple.com/us/app/zoo-lasso/id336842771?mt=8">Zoo Lasso $0.99</a></li>
<li><a href="http://itunes.apple.com/us/app/monkey-preschool-lunchbox/id328205875?mt=8">Monkey Preschool Lunchbox $0.99</a></li>
</ul>
<p>To see more cocos2d games, please visit: <a href="http://www.cocos2d-iphone.org/forum/forum/1">Games powered by cocos2d</a></p>
<p>Previous posts about cocos2d games:<a href="http://www.cocos2d-iphone.org/archives/60"> More than 100 games using cocos2d, 3 games in the top 10</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/723/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Chipmunk SpaceManager</title>
		<link>http://www.cocos2d-iphone.org/archives/677</link>
		<comments>http://www.cocos2d-iphone.org/archives/677#comments</comments>
		<pubDate>Mon, 15 Mar 2010 13:08:03 +0000</pubDate>
		<dc:creator>mobilebros</dc:creator>
				<category><![CDATA[chipmunk]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[spacemanager]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=677</guid>
		<description><![CDATA[
Cocos2d-iphone and Chipmunk
A while ago when I (MobileBros) was just beginning to use Cocos2d-iphone, I also started playing around with Chipmunk; at the time this was the only physics library that came with Cocos2d and I wasn&#8217;t really aware of anything else out there. Very quickly I discovered that I was writing a lot of [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/cocoschipmunkrainbow.png"><img class="aligncenter size-full wp-image-680" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/cocoschipmunkrainbow.png" alt="Cocos2d and Chipmunk" width="200" height="128" /></a></h3>
<h3>Cocos2d-iphone and Chipmunk</h3>
<p>A while ago when I (<a href="http://www.mobile-bros.com/">MobileBros</a>) was just beginning to use Cocos2d-iphone, I also started playing around with Chipmunk; at the time this was the only physics library that came with Cocos2d and I wasn&#8217;t really aware of anything else out there. Very quickly I discovered that I was writing a lot of repetitive code in order to use Chipmunk and what was more was that it was in C, making me have consider two languages now! Sound familar?</p>
<p><strong>Chipmunk:</strong><br />
Chipmunk is actually very simple in concept. There is a chipmunk &#8220;space&#8221;, you add shapes/bodies/constraints to the space, you ask the space to simulate a specific amount of time. Thats it! The last step performs all the magic that is rigid-body physics.</p>
<p><strong>Cocos2d Integration &#8211; Basic Approach:</strong><br />
Cocos2d is very good at a lot of things, its a very good at displaying sprites, particles, actions, touches, and a number of other things. Chipmunk is very good a simulating rigid-body physics. The common approach to &#8220;glueing&#8221; both components together usually involves running chipmunk and telling it to update Cocos2d nodes (setting position and rotation); pretty much a basic model-view approach. Modifying the constraints, and modifying collision behavior in the chipmunk system would result in different behavior; your game logic.</p>
<p>The SpaceManager attempts to step in as this glue and automate much of the process.</p>
<h3>What is SpaceManager?</h3>
<p>There are actually two distinct parts of the Chipmunk-SpaceManager project. There is the core <code>SpaceManager</code> class and then there are a number of &#8220;helper&#8221; classes targeting Cocos2d-iphone and used for representing shapes and constraints with <code>CCNode</code> types. In fact most people do not realize that these two parts are independent of each other.</p>
<p><strong>Core:</strong><br />
The goal of the core <code>SpaceManager</code> class was to provide an encapsulation around the basic tasks we (at least) found ourselves performing over and over. Theses tasks included:</p>
<ul>
<li>making basic shapes (rects, circles, polys)</li>
<li>removing shapes (especially a mechanism for during collisions)</li>
<li>advancing time within the chipmunk space</li>
<li>negligible API difference in Static and Active shapes</li>
<li>updating our views with our “model” (Chipmunk &#8211;&gt; Cocos2d)</li>
<li>updating our model with our controller/view (Cocos2d &#8211;&gt; Chipmunk)</li>
<li>non invasive to chipmunk (you can combine native chipmunk calls with spacemanager calls)</li>
<li>window containment walls (sounds dumb, but it’s tedious)</li>
</ul>
<p>Our aim was not exactly to wrap exising objects and functionality (In fact <a href="http://www.slembcke.net/">slembcke</a> just released an obj-c wrapper suite). Instead we wanted something to manage common tasks/patterns.</p>
<p><strong>Cocos2d Helpers:</strong><br />
The goal of the &#8220;helper&#8221; classes was to provide a simple solution to associating a shape/constraint with a corresponding <code>CCNode</code> type. By doing this we could also accomplish a number of other common tasks including: automatic cleanup of shape/body from chipmunk upon node deletion, as well as being able to control the position and rotation of shapes thru <code>CCAction's</code> or even just calling <code>setPosition</code> or <code>setRotation</code> on the node.</p>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sphelpersdiagram.png"><img class="aligncenter size-full wp-image-683" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/sphelpersdiagram.png" alt="" width="508" height="108" /></a></p>
<p><code>cpShapeNode</code> and <code>cpConstraintNode</code> are somewhat special in that they will draw their corresponding shape/constraint respectfully. For instance you just created a <code>cpConstraintNode</code> with a spring constraint, by adding this node type to a <code>CCLayer</code> or other <code>CCNode</code> it will correctly draw a spring constraint between the attached bodies (it uses OpenGL to draw a zig-zag line).</p>
<p>A base class called <code>cpCCNode</code> is provided for anyone wishing to derive their own class implementation. It provides:</p>
<ul>
<li><code>shape</code> property: your associated shape</li>
<li><code>integrationDt</code>: if other than zero, any call to setPosition (not coming from chipmunk) will result in velocity being calculated</li>
<li><code>spaceManager</code>: a reference to the owning spaceManager</li>
<li><code>autoFreeShape</code>: cleanup the shape, needs the spaceManager property set</li>
<li><code>applyImpulse</code>: apply an impulse to the shape&#8217;s body</li>
<li><code>applyForce</code>: apply a continuous force to the shape&#8217;s body</li>
<li><code>resetForces</code>: reset any continuous forces to zero</li>
</ul>
<h3>Give me an Example!</h3>
<p>Lets assume you are working on a <code>CCLayer</code> that you&#8217;ve just subclassed and want to integrate Chipmunk with. This layer will act as your space and any <code>CCNodes</code> added will represent your shapes and constraints.</p>
<p>First off, lets create our space and add a containment rect (so other shapes can&#8217;t go offscreen).</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">smgr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SpaceManager alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;       <span style="color: #11740a; font-style: italic;">//SpaceManager* smgr declared in header file</span>
<span style="color: #002200;">&#91;</span>smgr addWindowContainmentWithFriction<span style="color: #002200;">:</span><span style="color: #2400d9;">0.8</span> elasticity<span style="color: #002200;">:</span><span style="color: #2400d9;">0.7</span> inset<span style="color: #002200;">:</span>cpvzero<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Well it doesn&#8217;t look like much, but chipmunk was just initialized and a cpSpace was created and set up with default values and gravity. We then created a containment rect, thats somewhat bouncy with the friction coefficient of concrete, a concrete room if you will.</p>
<p><strong>Our First Shape:</strong><br />
Well thats all well and good, but lets add a ball next; lets use a <code>cpShapeNode</code> (a &#8220;helper&#8221; class) for this example because it only uses OpenGL primative calls to draw itself.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">cpShape <span style="color: #002200;">*</span>ball <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>smgr addCircleAt<span style="color: #002200;">:</span>cpv<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">240</span>,<span style="color: #2400d9;">160</span><span style="color: #002200;">&#41;</span> mass<span style="color: #002200;">:</span><span style="color: #2400d9;">5.0</span> radius<span style="color: #002200;">:</span><span style="color: #2400d9;">15</span><span style="color: #002200;">&#93;</span>;
&nbsp;
ballNode <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>cpShapeNode nodeWithShape<span style="color: #002200;">:</span>ball<span style="color: #002200;">&#93;</span>;       <span style="color: #11740a; font-style: italic;">//cpShapeNode *ballNode declared in header file</span>
ballNode.color <span style="color: #002200;">=</span> ccBLUE;
&nbsp;
ballNode.autoFreeShape <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
ballNode.spaceManager <span style="color: #002200;">=</span> smgr;
&nbsp;
<span style="color: #002200;">&#91;</span>self addChild<span style="color: #002200;">:</span>ballNode<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>We just asked the SpaceManager to create a circle shape for us, placed in the middle of the screen with a mass of 5 and a radius of 15; it gave us back a <code>cpShape*</code> which we then attached it to a <code>cpShapeNode</code>, colored it blue, and added to self (our <code>CCLayer</code>). Also important here is that we told the ballNode to auto-free it&#8217;s shape (when ballNode is released) and also who our SpaceManager instance was. This frees you from worrying about clean-up later.</p>
<p><strong>Crank it up:</strong><br />
At this point, things are starting to sound interesting, however if you ran the code right now, you&#8217;d wonder why there is a blue circle just sitting in the middle of the screen. Oh yeah! We need to tell chipmunk to start simulating our space.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>smgr start<span style="color: #002200;">:</span><span style="color: #2400d9;">1.0</span><span style="color: #002200;">/</span><span style="color: #2400d9;">60.0</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Woo-Hoo! We did it, a blue ball should fall from the center of the screen and bounce up and down a few times on the bottom of the screen. Well ok, thats not very interesting is it.</p>
<p><strong>Touches:</strong><br />
Perhaps we can make it do something in our touch methods. Don&#8217;t forget to set up your layer as a touch delegate&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> ccTouchBegan<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITouch<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>touch withEvent<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIEvent<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>event
<span style="color: #002200;">&#123;</span>
   CGPoint pt <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self convertTouchToNodeSpace<span style="color: #002200;">:</span>touch<span style="color: #002200;">&#93;</span>;
&nbsp;
   <span style="color: #002200;">&#91;</span>ballNode applyImpulse<span style="color: #002200;">:</span>ccpMult<span style="color: #002200;">&#40;</span>ccpSub<span style="color: #002200;">&#40;</span>pt, ballNode.position<span style="color: #002200;">&#41;</span>, <span style="color: #2400d9;">3</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
   <span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>This will give the ball a jolt in the direction you touch, stronger the further away you touch. Now if you only had a target to hit&#8230;. you&#8217;d have a game!</p>
<p><strong>A Game Idea&#8230;</strong><br />
$1,000,000 Game Idea: A ball and a target; touch to launch the ball at the target; the less touches it takes to hit the target, the more points you get!</p>
<p style="text-align: center;"><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/spgamescrnsht0.png"><img class="size-full wp-image-685 aligncenter" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/spgamescrnsht0.png" alt="" width="150" height="101" /></a></p>
<p>Ok so lets get a target going, perhaps a nice red square?</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">cpShape <span style="color: #002200;">*</span>target <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>smgr addRectAt<span style="color: #002200;">:</span>cpv<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">440</span>,<span style="color: #2400d9;">160</span><span style="color: #002200;">&#41;</span> mass<span style="color: #002200;">:</span>STATIC_MASS width<span style="color: #002200;">:</span><span style="color: #2400d9;">20</span> height<span style="color: #002200;">:</span><span style="color: #2400d9;">20</span> rotation<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
&nbsp;
targetNode <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>cpShapeNode nodeWithShape<span style="color: #002200;">:</span>target<span style="color: #002200;">&#93;</span>;       <span style="color: #11740a; font-style: italic;">//cpShapeNode *targetNode declared in header file</span>
targetNode.color <span style="color: #002200;">=</span> ccRED;
&nbsp;
targetNode.autoFreeShape <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
targetNode.spaceManager <span style="color: #002200;">=</span> smgr;
&nbsp;
<span style="color: #002200;">&#91;</span>self addChild<span style="color: #002200;">:</span>targetNode<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Nothing too dramatic here, EXCEPT whats this STATIC_MASS thing? Well in chipmunk terms <code>STATIC_MASS == INFINITY</code>, the former just seemed a little more definitive sounding. In chipmunk land there are shapes that are &#8220;active&#8221; and then there are shapes that are &#8220;static&#8221;, static shapes are never supposed to move; they are immovable as far as chipmunk sees things. Well what better use than for our target rectangle shape? Passing a <code>STATIC_MASS</code> for mass will make the SpaceManager perform the necessities it takes to set one up, everything else will look the same as when we created our ball above.</p>
<p><strong>Collision Callbacks:</strong><br />
We now have a ball, touch logic, and a target. All we need now is to know when the target has been hit. First off, we need to define a method to handle this.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> handleCollision<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CollisionMoment<span style="color: #002200;">&#41;</span>moment arbiter<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>cpArbiter<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>arb space<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>cpSpace<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>space
<span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>moment <span style="color: #002200;">==</span> COLLISION_BEGIN<span style="color: #002200;">&#41;</span>
   <span style="color: #002200;">&#123;</span>
      CCLabel <span style="color: #002200;">*</span>label <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>CCLabel labelWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;You Win!&quot;</span> fontName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica&quot;</span> fontSize<span style="color: #002200;">:</span><span style="color: #2400d9;">32</span><span style="color: #002200;">&#93;</span>;
      label.position <span style="color: #002200;">=</span> ccp<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">240</span>,<span style="color: #2400d9;">160</span><span style="color: #002200;">&#41;</span>;
      label.color <span style="color: #002200;">=</span> ccBLACK;
      <span style="color: #002200;">&#91;</span>self addChild<span style="color: #002200;">:</span>label<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//other moments: COLLISION_PRESOLVE, COLLISION_POSTSOLVE, COLLISION_SEPARATE</span>
&nbsp;
<span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>If you&#8217;re familar with chipmunk callback functions, you&#8217;ll notice that this is slightly similar but you are now passed a <code>CollisionMoment</code> variable as well. This enum tells you what collision moment we are at, in this case we only care about when the objects first begin touching.</p>
<p>Now don&#8217;t forget&#8230;. we need to register this callback with our SpaceManager instance:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">ballNode.shape<span style="color: #002200;">-&amp;</span>gt;collision_type <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
targetNode.shape<span style="color: #002200;">-&amp;</span>gt;collision_type <span style="color: #002200;">=</span> <span style="color: #2400d9;">2</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>smgr addCollisionCallbackBetweenType<span style="color: #002200;">:</span><span style="color: #2400d9;">1</span>
                            otherType<span style="color: #002200;">:</span><span style="color: #2400d9;">2</span>
                               target<span style="color: #002200;">:</span>self
                             selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>handleCollision<span style="color: #002200;">:</span>arbiter<span style="color: #002200;">:</span>space<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Thats it! If we just keep track of how many touches, perhaps display them too our game is all done. If anyone is interested in this example, the complete source is given here: <a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/SpaceManager-Example.zip">SpaceManager Example</a></p>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/spgamescrnsht1.png"><img class="aligncenter size-full wp-image-686" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/spgamescrnsht1.png" alt="" width="150" height="101" /></a></p>
<p>The SpaceManager can do a whole lot more than discussed here including: scheduling shapes for deletion, fragmenting shapes, morphing shapes between active and static, detecting persistent contacts, etc. The project web page can be found at <a href="http://code.google.com/p/chipmunk-spacemanager/">http://code.google.com/p/chipmunk-spacemanager/</a> and a more in-depth example is included with the source code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/677/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Learning cocos2d with samples</title>
		<link>http://www.cocos2d-iphone.org/archives/663</link>
		<comments>http://www.cocos2d-iphone.org/archives/663#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:35:21 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=663</guid>
		<description><![CDATA[Arguably the most unknown cocos2d feature is the tests/samples.
cocos2d contains almost a test for each feature that it has. These tests are grouped by component. eg:

Sprite Test: It tests the CCSprite and CCSpriteSheet functionality like anchorPoint, visibility, parenting, reordering, honor Transform, etc&#8230;
Action Test: It tests the CCMove, CCRotate, CCTint, CCCamera, CCSequence, CCSpawn, etc..
Menu Test: It tests [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png"><img class="alignright size-full wp-image-82" title="cocos2d icon" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png" alt="" width="67" height="67" /></a>Arguably the<strong> most unknown</strong> cocos2d <em>feature</em> is the tests/samples.<br />
cocos2d contains almost a test for each feature that it has. These tests are grouped by component. eg:</p>
<ul>
<li>Sprite Test: It tests the <code>CCSprite</code> and <code>CCSpriteSheet</code> functionality like anchorPoint, visibility, parenting, reordering, honor Transform, etc&#8230;</li>
<li>Action Test: It tests the <code>CCMove, CCRotate, CCTint, CCCamera, CCSequence, CCSpawn</code>, etc..</li>
<li>Menu Test: It tests all kind of menus</li>
<li>CocosDenshion: It tests the Sound Engine</li>
<li>Chipmunk Accel Touch Test: It tests integration with Chipmunk physics engine using accelerometer and multi touches.</li>
<li>Particle Test: It tests all kind of particles (quad particles, point particles, sun, meteor, galaxy, smoke, fire, etc&#8230;)</li>
<li>etc&#8230;</li>
</ul>
<p>Although these tests were coded for testing purposes they can also be used as examples. Not only they use the API in the recommended way, but some of them, also contain useful tips in the commentaries.</p>
<p>In order to run the tests, you should do:</p>
<ol>
<li>Open the cocos2d Xcode project</li>
<li>Select the test target: Xcode -&gt; Project -&gt; Set Active Target -&gt; eg: TransitionTest</li>
<li>Make sure that the running executable is correct: Xcode -&gt; Project -&gt; Set Active Executable -&gt; eg: TransitionTest</li>
<li>Build and run: Xcode -&gt; Build and run</li>
</ol>
<p>Another quick way of doing it by customizing the toolbar:</p>
<ol>
<li>Xcode -&gt; Right click on the toolbar -&gt; Customize Toolbar</li>
<li>Drag &amp; drop the <strong>Active Target</strong> button to the toolbar</li>
<li>Drag &amp; drop the <strong>Active Executable</strong> button to the toolbar</li>
</ol>
<p style="text-align: center;"><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-03-at-11.11.20.png"><img class="aligncenter size-full wp-image-665" title="Screen shot 2010-03-03 at 11.11.20" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-03-at-11.11.20.png" alt="" width="530" height="47" /></a></p>
<p>The source code of the samples are in the <a href="http://code.google.com/p/cocos2d-iphone/source/browse/#svn/tags/release-0.99.0/tests">tests</a> subdirectory.</p>
<p>So, let&#8217;s say you want to learn how to use Tiled maps. What you should do is:</p>
<ol>
<li>Select the TileMapTest target</li>
<li>Make sure that the TileMapTest executable is selected</li>
<li>Build &amp; Run.</li>
<li>Try all the subtests. The TileMapTest has more than 10 subtests. Eg: Hexagonal test, Isometric test, Orthogonal tests, read-write tile tests, etc&#8230;</li>
<li>See the TileMapTest source code: <a href="http://code.google.com/p/cocos2d-iphone/source/browse/tags/release-0.99.0/tests/TileMapTest.m">tests/TileMapTest.m</a></li>
<li>Modify the source code and go to step 2. <img src='http://www.cocos2d-iphone.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ol>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-03-at-11.26.24.png"><img class="aligncenter size-medium wp-image-667" title="Screen shot 2010-03-03 at 11.26.24" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-03-at-11.26.24-300x198.png" alt="" width="300" height="198" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/663/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hiding the images from your game</title>
		<link>http://www.cocos2d-iphone.org/archives/646</link>
		<comments>http://www.cocos2d-iphone.org/archives/646#comments</comments>
		<pubDate>Mon, 01 Mar 2010 20:39:31 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=646</guid>
		<description><![CDATA[
Sometimes it is needed to hide certain images in your game from opportunists. One possible way of doing it, is to subclass CCTextureCache and override the addImage method.
For example:

//pseudo code
-&#40;CCTexture2D*&#41; addImage:&#40;NSString*&#41;path
&#123;
   if&#40; file_exists&#40; path + &#34;.enc&#34; &#41;  &#123;
       mem = decrypt&#40; path + &#34;.enc&#34;, secretKey &#41;;
 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png"><img class="alignright size-full wp-image-82" title="cocos2d icon" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png" alt="" width="67" height="67" /></a></p>
<p>Sometimes it is needed to hide certain images in your game from <em>opportunists</em>. One possible way of doing it, is to subclass <code>CCTextureCache</code> and override the <code>addImage</code> method.</p>
<p>For example:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//pseudo code</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>CCTexture2D<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> addImage<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>path
<span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> file_exists<span style="color: #002200;">&#40;</span> path <span style="color: #002200;">+</span> <span style="color: #bf1d1a;">&quot;.enc&quot;</span> <span style="color: #002200;">&#41;</span>  <span style="color: #002200;">&#123;</span>
       mem <span style="color: #002200;">=</span> decrypt<span style="color: #002200;">&#40;</span> path <span style="color: #002200;">+</span> <span style="color: #bf1d1a;">&quot;.enc&quot;</span>, secretKey <span style="color: #002200;">&#41;</span>;
       uiimage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImage alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>mem<span style="color: #002200;">&#93;</span>;
       texture <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>CCTexture2D alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span>uiimage<span style="color: #002200;">&#93;</span>;
   <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Basically, if it finds an encrypted file, it will decrypt it with a secret key. So the .app bundle will have the crypted images, and <em>opportunists</em> won&#8217;t be able to look at them easily.</p>
<p>User <a href="http://www.gametakeaway.com/">mhussa</a> created a sample project that includes these ideas. The project includes:</p>
<ul>
<li><code>CCEncryptedTextureCache.m</code> (subclass of <code>CCTextureCache</code> )</li>
<li><code>CryptUtils.cpp</code> (helper functions to encrypt/decrypt files)</li>
<li>The &#8216;Encrypt&#8217; build phase: It encrypts files at build time. You don&#8217;t need to encrypt them manually!</li>
</ul>
<p>To customize which files to encrypt, you have to edit the &#8216;Encrypt&#8217; build phase:</p>
<ul>
<li>Xcode -&gt; Targets -&gt; CCRadialTransitionDemo -&gt; Encrypt</li>
<li>Right click over &#8216;Encrypt&#8217; -&gt; Get Info</li>
</ul>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-01-at-17.25.16.png"><img class="aligncenter size-medium wp-image-649" title="Screen shot 2010-03-01 at 17.25.16" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/03/Screen-shot-2010-03-01-at-17.25.16-300x250.png" alt="" width="300" height="250" /></a></p>
<p>For further info regarding mhussa&#8217;s implementation, please read: <a href="http://www.cocos2d-iphone.org/forum/topic/4681#post-28075">How to use CCEncryptedTextureCache</a></p>
<p><strong>Download</strong>: <a href="http://www.gametakeaway.com/temp/CCRadialTransitionDemo.zip">Xcode CCEncryptedTextureCache project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/646/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to CCSpriteFrameCache</title>
		<link>http://www.cocos2d-iphone.org/archives/633</link>
		<comments>http://www.cocos2d-iphone.org/archives/633#comments</comments>
		<pubDate>Mon, 01 Mar 2010 00:36:48 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=633</guid>
		<description><![CDATA[
Although it is possible to reuse the cocos2d v0.8 animation code, v0.99 introduces a new way to deal with animations (and sprites in general).
v0.99 has a new class named CCSpriteFrameCache that, as the name suggests, it is the cache of all the sprite frames.
You can load sprites frames to the CCSpriteFrameCache with:

a plist filename (generated [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png"><img class="alignright size-full wp-image-312" title="cocos2d_67" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png" alt="" width="67" height="67" /></a></p>
<p>Although it is possible to reuse the cocos2d v0.8 animation code, v0.99 introduces a new way to deal with animations (and sprites in general).</p>
<p>v0.99 has a new class named <code>CCSpriteFrameCache</code> that, as the name suggests, it is the cache of all the sprite frames.<br />
You can load sprites frames to the <code>CCSpriteFrameCache</code> with:</p>
<ul>
<li>a plist filename (generated by <a href="http://zwoptex.zwopple.com/">Zwoptex</a> editor)</li>
<li>a plist filename (generated by <a href="http://zwoptex.zwopple.com/">Zwoptex</a> editor) and a <code>CCTexture2D</code></li>
<li>a <code>CCSpriteFrame</code> and a sprite frame name</li>
</ul>
<p><em>( See the full API here: </em><a href="http://www.cocos2d-iphone.org/api-ref/0.99.0/interface_c_c_sprite_frame_cache.html"><em>CCSpriteFrameCache API</em></a><em> )</em></p>
<p>And the <a href="http://www.cocos2d-iphone.org/api-ref/0.99.0/interface_c_c_sprite_frame.html">CCSpriteFrame</a> object has the following properties:</p>
<ul>
<li>a <code><a href="http://www.cocos2d-iphone.org/api-ref/0.99.0/interface_c_c_texture2_d.html">CCTexture2D</a></code>: which texture should it use.</li>
<li>a <code>CGRect</code>: the rectangle of the texture (from 1 texture you can create many <code>CCSpriteFrame</code> objects, in fact it is the recommend way to avoid wasting unnecessary memory).</li>
</ul>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Obtain the shared instance of the cache</span>
CCSpriteFrameCache <span style="color: #002200;">*</span>cache <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>CCSpriteFrameCache sharedSpriteFrameCache;
&nbsp;
<span style="color: #11740a; font-style: italic;">// load the frames</span>
<span style="color: #002200;">&#91;</span>cache addSpriteFramesWithFile<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;frames.plist&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// It loads the frame named &quot;frame1.png&quot;.</span>
<span style="color: #11740a; font-style: italic;">// IMPORTANT: It doesn't load the image &quot;frame1.png&quot;. &quot;frama1.png&quot; is a just the name of the frame</span>
CCSpriteFrame <span style="color: #002200;">*</span>frame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>cache spriteFrameByName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;frame1.png&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>sprite setDisplayFrame<span style="color: #002200;">:</span>frame<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>This was just an introduction to <code>CCSpriteFrameCache</code>.</p>
<p>For further info, please read</p>
<ul>
<li>hhamm&#8217;s <a href="http://www.gehacktes.net/2010/02/programming-iphone-games-with-cocos2d-part-3/">Programming iPhone Games with Cocos2D Part 3</a></li>
<li>cocos2d programming guide: <a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:animation">Animations</a></li>
</ul>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/blob.gif"><img class="aligncenter size-full wp-image-639" title="blob" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/blob.gif" alt="" width="133" height="160" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/633/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cocos2d and Box2d encore</title>
		<link>http://www.cocos2d-iphone.org/archives/624</link>
		<comments>http://www.cocos2d-iphone.org/archives/624#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:16:30 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=624</guid>
		<description><![CDATA[Ray Wenderlich, again, wrote an interesting article about cocos2d and box2d.
This time, the article is about how to make a simple Breakout game.

How to make a simple Breakout game Part 1/2
How to make a simple Breakout game Part 2/2

The article includes:

How to setup Box2d (gravity, bodies, etc&#8230;)
How to handle collision detection in Box2d
How to add [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Box2D_logo.png"><img class="alignright size-full wp-image-616" title="Box2D_logo" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Box2D_logo.png" alt="" width="86" height="76" /></a><a href="http://www.raywenderlich.com/">Ray Wenderlich</a>, again, wrote an interesting article about cocos2d and box2d.</p>
<p>This time, the article is about how to make a simple Breakout game.</p>
<ul>
<li><a href="http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12">How to make a simple Breakout game Part 1/2</a></li>
<li><a href="http://www.raywenderlich.com/505/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-22">How to make a simple Breakout game Part 2/2</a></li>
</ul>
<p>The article includes:</p>
<ul>
<li>How to setup Box2d (gravity, bodies, etc&#8230;)</li>
<li>How to handle collision detection in Box2d</li>
<li>How to add and destroy Box2d bodies</li>
<li>How to link a CCSprite with a Box2d body</li>
<li>Uses touches to move the paddle</li>
<li>Plays music and sound effects using CocosDenshion</li>
<li>It has a You Win and a You lose scene</li>
<li>The Xcode project</li>
</ul>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-25-at-12.59.30.png"><img class="aligncenter size-medium wp-image-625" title="Screen shot 2010-02-25 at 12.59.30" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-25-at-12.59.30-300x156.png" alt="" width="300" height="156" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/624/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating cocos2d with Box2d</title>
		<link>http://www.cocos2d-iphone.org/archives/615</link>
		<comments>http://www.cocos2d-iphone.org/archives/615#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:26:25 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[box2d]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=615</guid>
		<description><![CDATA[Box2d is rigid-body physics engine that can be used as a good complement of cocos2d. In fact, cocos2d comes with 3 Xcode templates, and one of them is a cocos2d + box2d template.

Also, cocos2d comes with 2 box2d examples:

An accelerometer + multitouch box2d sample: Great sample for box2d newbies
And the box2d testbed: targeting more advanced users


Recently, Ray [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Box2D_logo.png"><img class="alignright size-full wp-image-616" title="Box2D_logo" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Box2D_logo.png" alt="" width="86" height="76" /></a><a href="http://www.box2d.org">Box2d</a> is rigid-body physics engine that can be used as a good complement of cocos2d. In fact, cocos2d comes with 3 Xcode templates, and one of them is a cocos2d + box2d template.</p>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-22-at-13.06.39.png"><img class="aligncenter size-medium wp-image-617" title="Screen shot 2010-02-22 at 13.06.39" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-22-at-13.06.39-300x204.png" alt="" width="300" height="204" /></a></p>
<p>Also, cocos2d comes with 2 box2d examples:</p>
<ul>
<li>An accelerometer + multitouch box2d <a href="http://code.google.com/p/cocos2d-iphone/source/browse/tags/release-0.99.0/tests/Box2dTest.mm">sample</a>: Great sample for box2d <em>newbies</em></li>
<li>And the <a href="http://code.google.com/p/cocos2d-iphone/source/browse/tags/release-0.99.0/tests/#tests/Box2DTestBed-Cocos2dIntegration">box2d testbed</a>: targeting more advanced users</li>
</ul>
<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-22-at-13.12.57.png"><img class="aligncenter size-medium wp-image-618" title="Screen shot 2010-02-22 at 13.12.57" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-22-at-13.12.57-300x156.png" alt="" width="300" height="156" /></a></p>
<p>Recently, <a href="http://www.raywenderlich.com">Ray Wenderlich</a> also wrote an interesting article regarding how use box2d with cocos2d v0.99.0:</p>
<ul>
<li><a href="http://www.raywenderlich.com/457/intro-to-box2d-with-cocos2d-tutorial-bouncing-balls">Intro to Box2D with Cocos2D Tutorial: Bouncing Balls</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/615/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cocos2d v0.99.0 released</title>
		<link>http://www.cocos2d-iphone.org/archives/598</link>
		<comments>http://www.cocos2d-iphone.org/archives/598#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:16:29 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=598</guid>
		<description><![CDATA[After:

123 days
94 closed issues
5 intermediate releases
329 commits

cocos2d for iPhone v0.99.0 was released!
Download: cocos2d-iphone-0.99.0.tar.gz
Release Notes: release_notes:0_99_0
Full Changelog: CHANGELOG
Many thanks to all the developers, contributors, beta testers, and the community in general. We are building a professional-grade library both in terms of technical features and support!
]]></description>
			<content:encoded><![CDATA[<p>After:<a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/fireworks1.jpg"><img class="alignright size-medium wp-image-599" title="Fireworks" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/fireworks1-300x240.jpg" alt="Fireworks" width="300" height="240" /></a></p>
<ul>
<li>123 days</li>
<li>94 <a href="http://code.google.com/p/cocos2d-iphone/issues/list?can=1&amp;q=milestone%3DRelease0.99.0">closed issues</a></li>
<li>5 <a href="http://code.google.com/p/cocos2d-iphone/downloads">intermediate releases</a></li>
<li>329 <a href="http://code.google.com/p/cocos2d-iphone/source/browse/#svn/tags/release-0.99.0">commits</a></li>
</ul>
<p><em>cocos2d for iPhone</em> v0.99.0 was released!</p>
<p><strong>Download</strong>: <a href="http://cocos2d-iphone.googlecode.com/files/cocos2d-iphone-0.99.0.tar.gz">cocos2d-iphone-0.99.0.tar.gz</a></p>
<p><a href="http://cocos2d-iphone.googlecode.com/files/cocos2d-iphone-0.99.0.tar.gz"></a><strong>Release Notes: </strong><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0">release_notes:0_99_0</a></p>
<p><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0"></a><strong>Full Changelog</strong>: <a href="http://cocos2d-iphone.googlecode.com/svn/tags/release-0.99.0/CHANGELOG">CHANGELOG</a></p>
<p>Many thanks to all the <a href="http://cocos2d-iphone.googlecode.com/svn/tags/release-0.99.0/AUTHORS">developers</a>, <a href="http://cocos2d-iphone.googlecode.com/svn/tags/release-0.99.0/AUTHORS">contributors</a>, beta testers, and the <a href="http://www.cocos2d-iphone.org/forum">community</a> in general. We are building a professional-grade library both in terms of technical features and support!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/598/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Integrating cocos2d with Facebook Connect</title>
		<link>http://www.cocos2d-iphone.org/archives/590</link>
		<comments>http://www.cocos2d-iphone.org/archives/590#comments</comments>
		<pubDate>Tue, 16 Feb 2010 14:49:24 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=590</guid>
		<description><![CDATA[Jeston Furqueron wrote a nice tutorial regarding how to integrate cocos2d with Facebook Connect.
You can read the turorial from:

Tutorial: Using Facebook Connect with cocos2d (Jeston&#8217;s homepage)
or Tutorial: Using Facebook Connect with cocos2d (cocos2d forum)

The tutorial uses cocos2d v0.8.x, and it can easily be ported to cocos2d v0.99
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/facebook_logo.jpg"><img class="alignright size-full wp-image-591" title="facebook_logo" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2010/02/facebook_logo.jpg" alt="" width="49" height="49" /></a><a href="http://www.loudgames.net/">Jeston Furqueron</a> wrote a nice tutorial regarding how to integrate cocos2d with <a href="http://developers.facebook.com/connect.php?tab=iphone">Facebook Connect</a>.</p>
<p>You can read the turorial from:</p>
<ul>
<li><a href="http://www.loudgames.net/?p=17">Tutorial: Using Facebook Connect with cocos2d</a> (Jeston&#8217;s homepage)</li>
<li>or <a href="http://www.cocos2d-iphone.org/forum/topic/3392">Tutorial: Using Facebook Connect with cocos2d</a> (cocos2d forum)</li>
</ul>
<p>The tutorial uses cocos2d v0.8.x, and it can easily be ported to cocos2d v0.99</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/590/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cocos2d v0.99.0-final released</title>
		<link>http://www.cocos2d-iphone.org/archives/588</link>
		<comments>http://www.cocos2d-iphone.org/archives/588#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:31:28 +0000</pubDate>
		<dc:creator>riq</dc:creator>
				<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.cocos2d-iphone.org/?p=588</guid>
		<description><![CDATA[cocos2d for iPhone v0.99.0-final is available for download
Download: cocos2d-iphone-0.99.0-final.tar.gz
Release Notes: release_notes:0_99_0_final
Changelog: CHANGELOG
Highlights (from v0.99.0-rc):

CocosDenshion: many fixes and improvements
Fixed some crashes and other important fixes on: Sprites &#38; TMX maps

Known bugs: known_bugs
How stable is this release ?
Very stable. According to the tests and feedback from the testers, this release can be considered v0.99.0. But since v0.99.0 [...]]]></description>
			<content:encoded><![CDATA[<p>cocos2d for iPhone v0.99.0-final is available for download<a href="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png"><img class="alignright size-full wp-image-82" title="cocos2d icon" src="http://www.cocos2d-iphone.org/blog/wp-content/uploads/2009/06/cocos2d_67.png" alt="" width="67" height="67" /></a></p>
<p><strong>Download: </strong><a href="http://cocos2d-iphone.googlecode.com/files/cocos2d-iphone-0.99.0-final.tar.gz">cocos2d-iphone-0.99.0-final.tar.gz</a></p>
<p><strong>Release Notes: </strong><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0_final">release_notes:0_99_0_final</a></p>
<p><strong>Changelog: </strong><a href="http://cocos2d-iphone.googlecode.com/svn/tags/release-0.99.0-final/CHANGELOG">CHANGELOG</a></p>
<p><strong>Highlights</strong> (from v0.99.0-rc):</p>
<ul>
<li>CocosDenshion: many fixes and improvements</li>
<li>Fixed some crashes and other important fixes on: Sprites &amp; TMX maps</li>
</ul>
<p><strong>Known bugs: </strong><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0_final#known_bugs">known_bugs</a></p>
<p><strong>How stable is this release ?</strong><br />
Very stable. According to the tests and feedback from the testers, this release can be considered v0.99.0. But since v0.99.0 introduces so many changes, this will the last pre-v0.99.0 release.</p>
<p>If there are no show-stoppers bugs, then, this will be the real v0.99.0 version.<br />
No small fixes will be introduced unless they are show-stopper bugs.<br />
Small fixes and improvements will be fixed during the v0.99.x series.</p>
<p><strong>How fast is this release ?</strong><br />
All the performance tests were run, and v0.99.0-final is, at least, as fast as v0.8.2. In some cases it is faster, perhaps 10%~20% faster.</p>
<p>I would appreciate if you could test this release in your game. Please, report any bug that you might find.<br />
Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cocos2d-iphone.org/archives/588/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
