<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Forum: cocos2d support (graphics engine) - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/forum/2</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 03:28:12 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/forum/2/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>fuzz on "Trimming final app size"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29117#post-143462</link>
			<pubDate>Thu, 09 Feb 2012 16:33:26 +0000</pubDate>
			<dc:creator>fuzz</dc:creator>
			<guid isPermaLink="false">143462@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Im trying to keep my app under 20 megs, currently the zipped release compiled app sits at 22,1 megs, but my images, sounds, classes and extras comes to 15 megs. Are the rest from cocos2d's libraries? Is there a way to check what the finished app contains?
</p></description>
		</item>
		<item>
			<title>Bongeh on "Completely whiting out a sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/16527#post-93178</link>
			<pubDate>Fri, 13 May 2011 15:07:32 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">93178@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey, I'm trying to completely white out a sprite when it gets hit, the sprites are children of a batchnode.</p>
<p>Using this code, I can tint the sprite fully black, but I have to use the rgb value for white to get it back to being coloured. </p>
<pre><code>[self setColor:ccc3(0, 0, 0)];</code></pre>
<p>How can I fully white out the sprite, rather than black it out?
</p></description>
		</item>
		<item>
			<title>serrias on "RTS game logic"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29140#post-143537</link>
			<pubDate>Fri, 10 Feb 2012 01:38:01 +0000</pubDate>
			<dc:creator>serrias</dc:creator>
			<guid isPermaLink="false">143537@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey everyone, First post here am looking for some advice :)<br />
Am relatively new to game-design specifically in objective-c (last month or so) but I've done apps and programming before, So far I've created a few 2d games with just cocos2d, relatively basic... I have no problems with the programming aspect and have got a pretty good understanding of objective-c by now,</p>
<p>Anyhow I'm trying to design a RTS game, I started two days ago and created a system whereby the "objects"(characters) were stored in arrays and looped though every second at this point...<br />
In fact I wont bother explaining any more, my system was very bad and I could clearly see why it was inefficient, I don't want to waste your time with explaining it when its obviously completely wrong!</p>
<p>What is the best way of creating a RTS game logic and storage, I was thinking along the lines of:<br />
Array for all current world objects<br />
Tilemap for terrain<br />
And then I get stuck as to how to implement the movement.. Do I create a "Movement" array that would hold the id's and velocity's of every sprite that is moving, then iterate though this updating the sprites each frame?</p>
<p>Also I understand how to implement path finding that will not be a problem, but the issue is that objects will be moving, Do I perhaps re-find a new path if I am about to collide with another character, </p>
<p>Another problem is say for example there is a large group of characters in-front of you, you would initially want to find a path around them, but they may move out of the way... in which case you would want to walk where they were. I can think of only one efficient way of solving this which is to completely ignore all characters/objects on the initial path other than terrain, and deal with it when you are about to collide with them?</p>
<p>I hope this all makes sense!!</p>
<p>I'm really stuck.. Any advice and help would be greatly appreciated, Thank you very much in advance :)<br />
Rob
</p></description>
		</item>
		<item>
			<title>neurofluid on "Masking particle system"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1993#post-12527</link>
			<pubDate>Mon, 21 Sep 2009 05:33:27 +0000</pubDate>
			<dc:creator>neurofluid</dc:creator>
			<guid isPermaLink="false">12527@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi All, </p>
<p>is there an easy way to mask the particle system to only show within the width and height of another object instead of the whole scene?</p>
<p>I've tried making the particle emitter a child of a sprite, a layer, etc and it always seems to ignore any boundaries of its parent object. It would seem to me that the particles shouldn't move past them (I may be misunderstanding the way the particle system works though).</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>whitewidget on "CCSprite Problem with Blending when using Custom Drawing"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29116#post-143461</link>
			<pubDate>Thu, 09 Feb 2012 16:23:46 +0000</pubDate>
			<dc:creator>whitewidget</dc:creator>
			<guid isPermaLink="false">143461@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've been having problems with blending when using custom drawing code in my CCSprite. I modified CCSprite to take note of vertices like a grid, in order for me to move those vertices and distort the sprite. After doing so, whenever there's an image added to the scene before adding the modified sprite into the scene, their blending doesn't work. The transparent parts of the image becomes black and the modified sprite cannot overwrite them. I tried different blending modes on the modified sprite to no avail. I even put GL_DST_ALPHA but it just made my modified sprite completely disappear :&#124;</p>
<p>The grid code I used is taken from CocosDistort by piferrari</p>
<p>In my CCSprite, I just added this code to the init method:</p>
<blockquote><p>
-(void) initGridPoints<br />
{</p>
<p>    GLint width = texture_.contentSizeInPixels.width;<br />
    GLint height = texture_.contentSizeInPixels.height;<br />
    int i, j;<br />
    int k;<br />
    int m;</p>
<p>    if (_mass == NULL)<br />
    {<br />
        _mass = (MASS*) malloc(sizeof(MASS)*GRID_SIZE_X*GRID_SIZE_Y);<br />
        if (_mass == NULL)<br />
        {<br />
            fprintf(stderr,"Can't allocate memroy.\n");<br />
            exit(-1);<br />
        }<br />
    }</p>
<p>    k = 0;<br />
    for (i = 0; i &#60; GRID_SIZE_X; i++)<br />
        for (j = 0; j &#60; GRID_SIZE_Y; j++)<br />
        {<br />
            _mass[k].nail = (i == 0 &#124;&#124; j == 0 &#124;&#124; i == GRID_SIZE_X - 1<br />
                             &#124;&#124; j == GRID_SIZE_Y - 1);<br />
            _mass[k].x[0] = i/(GRID_SIZE_X - 1.0)*width;<br />
            _mass[k].x[1] = j/(GRID_SIZE_Y - 1.0)*height;<br />
            _mass[k].x[2] = -(CLIP_FAR - CLIP_NEAR)/2.0;</p>
<p>            _mass[k].v[0] = 0.0;<br />
            _mass[k].v[1] = 0.0;<br />
            _mass[k].v[2] = 0.0;</p>
<p>            _mass[k].t[0] = i/(GRID_SIZE_X - 1.0);<br />
            _mass[k].t[1] = j/(GRID_SIZE_Y - 1.0);</p>
<p>            k++;<br />
        }</p>
<p>    if (_spring == NULL)<br />
    {<br />
        _springCount = (GRID_SIZE_X - 1)*(GRID_SIZE_Y - 2)<br />
        + (GRID_SIZE_Y - 1)*(GRID_SIZE_X - 2);</p>
<p>        _spring = (SPRING *) malloc(sizeof(SPRING)*_springCount);<br />
        if (_spring == NULL)<br />
        {<br />
            fprintf(stderr, "rubber: Can't allocate memory.\n");<br />
            exit(-1);<br />
        }<br />
    }</p>
<p>    k = 0;<br />
    for (i = 1; i &#60; GRID_SIZE_X - 1; i++)<br />
        for (j = 0; j &#60; GRID_SIZE_Y - 1; j++)<br />
        {<br />
            m = GRID_SIZE_Y*i + j;<br />
            _spring[k].i = m;<br />
            _spring[k].j = m + 1;<br />
            _spring[k].r = (height - 1.0)/(GRID_SIZE_Y - 1.0);<br />
            k++;<br />
        }</p>
<p>    for (j = 1; j &#60; GRID_SIZE_Y - 1; j++)<br />
    {<br />
        for (i = 0; i &#60; GRID_SIZE_X - 1; i++)<br />
        {<br />
            m = GRID_SIZE_Y*i + j;<br />
            _spring[k].i = m;<br />
            _spring[k].j = m + GRID_SIZE_X;<br />
            _spring[k].r = (width - 1.0)/(GRID_SIZE_X - 1.0);<br />
            k++;<br />
        }<br />
    }</p>
<p>    for ( i = 0; i &#60; GRID_SIZE_Y - 1; i++ )<br />
    {<br />
        for ( j = 0; j &#60; GRID_SIZE_X - 1; j++ )<br />
        {<br />
            k = i * GRID_SIZE_X + j;<br />
            _indices[k * 6 + 0] = ( i     ) * GRID_SIZE_X + j;<br />
            _indices[k * 6 + 1] = ( i + 1 ) * GRID_SIZE_X + j;<br />
            _indices[k * 6 + 2] = ( i + 1 ) * GRID_SIZE_X + j + 1;<br />
            _indices[k * 6 + 3] = ( i     ) * GRID_SIZE_X + j;<br />
            _indices[k * 6 + 4] = ( i + 1 ) * GRID_SIZE_X + j + 1;<br />
            _indices[k * 6 + 5] = ( i     ) * GRID_SIZE_X + j + 1;<br />
        }<br />
    }<br />
}
</p></blockquote>
<p>And changed my draw method to:</p>
<blockquote><p>
-(void) draw<br />
{<br />
	[super draw];</p>
<p>	NSAssert(!usesBatchNode_, @"If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#<a href='http://www.cocos2d-iphone.org/forum/tags/draw'>draw</a> SHOULD NOT be called");</p>
<p>	// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY<br />
	// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY<br />
	// Unneeded states: -</p>
<p>	BOOL newBlend = blendFunc_.src != CC_BLEND_SRC &#124;&#124; blendFunc_.dst != CC_BLEND_DST;<br />
	if( newBlend )<br />
		glBlendFunc( blendFunc_.src, blendFunc_.dst );</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> kQuadSize sizeof(quad_.bl)<br />
	glBindTexture(GL_TEXTURE_2D, [texture_ name]);</p>
<p>	long offset = (long)&#38;quad_;</p>
<p>    int k = 0;<br />
    int i, j;<br />
    if(_mass == NULL) {<br />
        NSLog(@"mass is null");<br />
        return;<br />
    }</p>
<p>    for (i = 0; i &#60; GRID_SIZE_X - 1; i++)<br />
    {<br />
        for (j = 0; j &#60; GRID_SIZE_Y - 1; j++)<br />
        {<br />
            GLfloat vertices[]= {<br />
                _mass[k].x[0],_mass[k].x[1],_mass[k].x[2],<br />
                _mass[k + 1].x[0],_mass[k + 1].x[1],_mass[k + 1].x[2],<br />
                _mass[k + GRID_SIZE_Y + 1].x[0],_mass[k + GRID_SIZE_Y + 1].x[1],_mass[k + GRID_SIZE_Y + 1].x[2],<br />
                _mass[k + GRID_SIZE_Y].x[0],_mass[k + GRID_SIZE_Y].x[1],_mass[k + GRID_SIZE_Y].x[2]<br />
            };<br />
            GLfloat tex[]={<br />
                _mass[k].t[0], _mass[k].t[1],<br />
                _mass[k + 1].t[0], _mass[k + 1].t[1],<br />
                _mass[k + GRID_SIZE_Y + 1].t[0], _mass[k + GRID_SIZE_Y + 1].t[1],<br />
                _mass[k + GRID_SIZE_Y].t[0], _mass[k + GRID_SIZE_Y].t[1]<br />
            };</p>
<p>            glVertexPointer(3, GL_FLOAT, 0, vertices);</p>
<p>            glTexCoordPointer(2, GL_FLOAT, 0, tex);</p>
<p>            glDrawArrays(GL_TRIANGLE_FAN, 0, 4);</p>
<p>            k++;<br />
        }<br />
        k++;<br />
    }</p>
<p>	// vertex<br />
	NSInteger diff = offsetof( ccV3F_C4B_T2F, vertices);<br />
	//glVertexPointer(3, GL_FLOAT, kQuadSize, (void*) (offset + diff) );</p>
<p>	// color<br />
	diff = offsetof( ccV3F_C4B_T2F, colors);<br />
	glColorPointer(4, GL_UNSIGNED_BYTE, kQuadSize, (void*)(offset + diff));</p>
<p>	// tex coords<br />
	diff = offsetof( ccV3F_C4B_T2F, texCoords);<br />
	//glTexCoordPointer(2, GL_FLOAT, kQuadSize, (void*)(offset + diff));</p>
<p>	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);</p>
<p>	if( newBlend )<br />
		glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/if'>if</a> CC_SPRITE_DEBUG_DRAW == 1<br />
	// draw bounding box<br />
	CGPoint vertices[4]={<br />
		ccp(quad_.tl.vertices.x,quad_.tl.vertices.y),<br />
		ccp(quad_.bl.vertices.x,quad_.bl.vertices.y),<br />
		ccp(quad_.br.vertices.x,quad_.br.vertices.y),<br />
		ccp(quad_.tr.vertices.x,quad_.tr.vertices.y),<br />
	};<br />
	ccDrawPoly(vertices, 4, YES);<br />
#elif CC_SPRITE_DEBUG_DRAW == 2<br />
	// draw texture box<br />
	CGSize s = self.textureRect.size;<br />
	CGPoint offsetPix = self.offsetPositionInPixels;<br />
	CGPoint vertices[4] = {<br />
		ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y),<br />
		ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height)<br />
	};<br />
	ccDrawPoly(vertices, 4, YES);<br />
#endif // CC_SPRITE_DEBUG_DRAW</p>
<p>}</p>
</blockquote></description>
		</item>
		<item>
			<title>flyhigh209 on "ScrollView in cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9015#post-52095</link>
			<pubDate>Wed, 25 Aug 2010 13:30:00 +0000</pubDate>
			<dc:creator>flyhigh209</dc:creator>
			<guid isPermaLink="false">52095@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi,all.<br />
I add the ScrollView to the CCLayer,but it can not scroll when I touch it.<br />
 What should I do to let it work?<br />
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 3000)];<br />
scrollView.maximumZoomScale = 4.0;<br />
scrollView.minimumZoomScale = 0.75;<br />
scrollView.clipsToBounds = YES;<br />
scrollView.delegate = self;<br />
UIView *theView = [[CCDirector sharedDirector] openGLView];<br />
[theView addSubview:scrollView];<br />
 [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
</p></description>
		</item>
		<item>
			<title>riq on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143486</link>
			<pubDate>Thu, 09 Feb 2012 19:10:33 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">143486@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>So,</p>
<p>If you didn't know, when you create a texture, iOS will allocate 33% more memory, presumably to have enough room in case mipmaps are needed.<br />
( <a href="http://www.cocos2d-iphone.org/forum/topic/23887#post-129097" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/23887#post-129097</a> )</p>
<p>But it is worth noting that this bug is only present on POT (Power Of Two) textures ( Mipmapping is only supported on POT textures ).<br />
So, in order to reduce memory, what you have to do is two create NPOT textures.</p>
<p>eg:<br />
If you are using a 2048x2048 textures, convert it into a 2048x2047 textures (and you will save 33% memory).<br />
In case you can't make it smaller, then make it bigger. eg:<br />
If you have a 2048x1024 texture, create a 2048x1025 texture.</p>
<p>If you are using cocos2d v1.0, then you have to edit <code>ccConfig.h</code> with:<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> CC_TEXTURE_NPOT_SUPPORT 1</code></pre>
<p>If you are using v1.1 or v2.0, then you are OK, since they already support NPOT textures by default.</p>
<p>Ways to know if you are using POT / NPOT textures:<br />
<strong>A)</strong>  Parse your PNG, GIF, BMP, JPEG files with <code>file</code>:<br />
<pre><code>$ find . -name &#34;*.png&#34; -print0 &#124; xargs -0 file</code></pre>
<p><strong>B)</strong> Run this line of code and see your debug console:<br />
<pre><code>[[CCTextureCache sharedTextureCache] dumpCachedTextureInfo];</code></pre>
<p>Further info:<br />
<a href="https://devforums.apple.com/thread/113889?start=0&#038;tstart=0" rel="nofollow">https://devforums.apple.com/thread/113889?start=0&#038;tstart=0</a></p>
<p>Important: NPOT textures can't have mipmaps, and also they only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}</p>
<p>Important 2: PVRTC (2bpp and 4bpp) textures can't be converted to NPOT
</p></description>
		</item>
		<item>
			<title>marciokoko on "z values"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29139#post-143524</link>
			<pubDate>Thu, 09 Feb 2012 22:26:30 +0000</pubDate>
			<dc:creator>marciokoko</dc:creator>
			<guid isPermaLink="false">143524@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Im working on a game and the bacgrkound sprite is covering everything:</p>
<p>Scene calls<br />
background layer and adds it to z:1<br />
action layer and adds it to z:0</p>
<p>ActionLayer<br />
adds batchNode to z:0<br />
adds batch node sprites to z:2</p>
<p>BackgroundLayer<br />
adds bacgrkound image to z:0</p>
<p>why wouldn't this work?  why would the background image cover everything else?  its in the lowest z value, 0.
</p></description>
		</item>
		<item>
			<title>Hemingway72 on "Cocos 2D slow vs native OpenGL"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29105#post-143398</link>
			<pubDate>Thu, 09 Feb 2012 05:40:11 +0000</pubDate>
			<dc:creator>Hemingway72</dc:creator>
			<guid isPermaLink="false">143398@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi All,</p>
<p>Does the overhead of using cocos 2D mean that I will never achieve the quality of animation compared to using native opengl?</p>
<p>I've been playing around creating a basic Breakout style game using cocos 2D. The ball movement is achieved through updating ball.position * delta (change in time) each iteration of the game loop.<br />
When I compare the look and feel of my animation to that achieved in Atari's own version of Breakout (free version on the app store) they are miles apart. Atari's animation has  very solid look and feel to it. Is there a trick that I have missed with cocos 2D, or is this just something we have to settle for?</p>
<p>Cheers,
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143466</link>
			<pubDate>Thu, 09 Feb 2012 16:50:53 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">143466@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>This is one of those stupid technical problem that I should be able to solve by now, but being bogged down by work and struggling to find programming time I can't seem to figure this out. </p>
<p>Class A is a singleton, it receives input from the user interface using Interface Builder.<br />
Class B is a CCLayer subclass (HelloWorldLayer)</p>
<p>B needs to know about a to send it some data via a method.<br />
A needs to know about B to call some methods in it when it receives certain file data from the NSOpenPanel. </p>
<p>B #imports A<br />
But if A imports B there are problems - (circular importing)  </p>
<p>How should I properly reference each class?
</p></description>
		</item>
		<item>
			<title>neigaard on "Is it possible to mix RGBA8888 and RGBA4444 in the same scene/layer?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29122#post-143489</link>
			<pubDate>Thu, 09 Feb 2012 19:28:56 +0000</pubDate>
			<dc:creator>neigaard</dc:creator>
			<guid isPermaLink="false">143489@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi</p>
<p>I would like to use RGBA4444 in some of my PVR textures and RGBA8888 in others of my PVR textures. No as I understand it the PVR includes information about wether it is RGBA8888 or RGBA4444, but will cocos2d work well with this also reducing memory usage on the RGBA4444 textures and still render my RGBA8888 textures in lovely 32 bit?</p>
<p>Thank you<br />
Søren
</p></description>
		</item>
		<item>
			<title>noodlz on "Moving a sprite across multiple coordinates using CCSequence"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29115#post-143460</link>
			<pubDate>Thu, 09 Feb 2012 16:21:53 +0000</pubDate>
			<dc:creator>noodlz</dc:creator>
			<guid isPermaLink="false">143460@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello! Long time reader, first time poster.</p>
<p>I have a predefined set of coordinates which form a path stored in two NSMutableArrays (one containing the x values, one for the y values). There are roughly 40 sets of coordinates.</p>
<p>Below is the section of code I am currently using:</p>
<p>    id patrolAction;<br />
    int pat_x1, pat_y1;<br />
    CCSequence *moveSequence;</p>
<p>            for (int x = 0; x&#60;[patrolPathX1 count]; x++){</p>
<p>                pat_x1=[[patrolPathX1 objectAtIndex:x]intValue];<br />
                pat_y1=[[patrolPathY1 objectAtIndex:x]intValue];</p>
<p>                patrolAction = [CCMoveTo actionWithDuration:1.5 position:[self positionForTileCoord:CGPointMake((float) pat_x1, (float) pat_y1)]]; </p>
<p>                moveSequence = [CCSequence actions:patrolAction, nil];</p>
<p>                [enemy2 runAction:moveSequence];<br />
            }</p>
<p>The aim is to get the sprite (enemy2) to move along this predefined path, however the sprite is just moving across to the final set of coordinates straight away. When I take out the for loop and hardcode them individually, it works fine. </p>
<p>(When I put the "runAction" outside of the for loop, the same effect is produced)</p>
<p>I have tried putting in a CCDelayTime in the sequence, yet this doesn't seem to help. </p>
<p>Can anyone help me out with this issue? </p>
<p>Thanks in advance :)
</p></description>
		</item>
		<item>
			<title>jptsetung on "CCSpriteBatchNode and CCSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29113#post-143437</link>
			<pubDate>Thu, 09 Feb 2012 13:05:42 +0000</pubDate>
			<dc:creator>jptsetung</dc:creator>
			<guid isPermaLink="false">143437@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm thinking about extending the CCSpriteBatchNode to support more complex forms of sprites.<br />
For example, a CCSpriteBatchNode that would support CCProgressTimer, CCMotionStreak, etc...<br />
My understanding of opengl is not good enough to be sure we can do this.</p>
<p>Is it possible to build something like this? I don't really know how the sprite batch node works, but maybe this new batch node could rely on a protocol that the extensions (CCProgressTimer, etc... )  should have to implement in order they are compatible with the batch node drawings?
</p></description>
		</item>
		<item>
			<title>TheCodeTroll on "CCprogressTimer blues! Unable to use Sprite Sheets?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29021#post-143088</link>
			<pubDate>Tue, 07 Feb 2012 18:01:52 +0000</pubDate>
			<dc:creator>TheCodeTroll</dc:creator>
			<guid isPermaLink="false">143088@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey, so I'm using a progress timer, as a kind of energy /health representation.<br />
And all works very nicely, if i just use a single .png file, right from resources on its own.</p>
<p>But as I'm trying to save space, and keep things together nicely, I'm using sprite sheets for everything.<br />
Which also, is working very nicely. The only problem is I can't get the progress timer to work, AT ALL<br />
With a frame from my tile sheet...</p>
<p>I can initWithTexture, and give it the tile sheet, but as expected it uses the whole sheet as the sprite.<br />
I wrote an init with spriteFrameName method for the CCProgressTimer class,<br />
Where I Init self.sprite with the [CCSprite spriteWithSpriteFrameName: ]; method...<br />
But this doesnt work either, The sprite is returned, as there is data in self.sprite, but it wont draw it.<br />
I also went back and tried it by initialising with a dummy image, and then calling [progressTime setSprite:];<br />
but even calling that and setting it to a sprite that came from the sprite sheet ISNT WORKING :&#124;<br />
is there any reason at all that the class does this / was designed this way O_o?</p>
<p>I apreciate any input help, or advice... thanks :/
</p></description>
		</item>
		<item>
			<title>Ap3x on "Need help to update tweejump sourcecode to 1.xx"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28885#post-142361</link>
			<pubDate>Thu, 02 Feb 2012 19:17:15 +0000</pubDate>
			<dc:creator>Ap3x</dc:creator>
			<guid isPermaLink="false">142361@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello,<br />
i'm using xcode 4 and cocos2d 1.01 and<br />
i have a problem with the tweejump project.</p>
<p>this is the code from the original project:</p>
<p>---------------------------------------------<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "Highscores.h"<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "Main.h"<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "Game.h"</p>
<p>@interface Highscores (Private)<br />
- (void)loadCurrentPlayer;<br />
- (void)loadHighscores;<br />
- (void)updateHighscores;<br />
- (void)saveCurrentPlayer;<br />
- (void)saveHighscores;<br />
- (void)button1Callback:(id)sender;<br />
- (void)button2Callback:(id)sender;<br />
@end</p>
<p>@implementation Highscores</p>
<p>- (id)initWithScore:(int)lastScore {<br />
//	NSLog(@"Highscores::init");</p>
<p>	if(![super init]) return nil;</p>
<p>//	NSLog(@"lastScore = %d",lastScore);</p>
<p>	currentScore = lastScore;</p>
<p>//	NSLog(@"currentScore = %d",currentScore);</p>
<p>	[self loadCurrentPlayer];<br />
	[self loadHighscores];<br />
	[self updateHighscores];<br />
	if(currentScorePosition &#62;= 0) {<br />
		[self saveHighscores];<br />
	}</p>
<p>	AtlasSpriteManager *spriteManager = (AtlasSpriteManager*)[self getChildByTag:kSpriteManager];</p>
<p>	AtlasSprite *title = [AtlasSprite spriteWithRect:CGRectMake(608,192,225,57) spriteManager:spriteManager];<br />
	[spriteManager addChild:title z:5];<br />
	title.position = ccp(160,420);</p>
<p>	float start_y = 360.0f;<br />
	float step = 27.0f;<br />
	int count = 0;<br />
	for(NSMutableArray *highscore in highscores) {<br />
		NSString *player = [highscore objectAtIndex:0];<br />
		int score = [[highscore objectAtIndex:1] intValue];</p>
<p>		Label *label1 = [Label labelWithString:[NSString stringWithFormat:@"%d",(count+1)] dimensions:CGSizeMake(30,40) alignment:UITextAlignmentRight fontName:@"Arial" fontSize:14];<br />
		[self addChild:label1 z:5];<br />
		[label1 setRGB:0 :0 :0];<br />
		[label1 setOpacity:200];<br />
		label1.position = ccp(15,start_y-count*step-2.0f);</p>
<p>		Label *label2 = [Label labelWithString:player dimensions:CGSizeMake(240,40) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:16];<br />
		[self addChild:label2 z:5];<br />
		[label2 setRGB:0 :0 :0];<br />
		label2.position = ccp(160,start_y-count*step);</p>
<p>		Label *label3 = [Label labelWithString:[NSString stringWithFormat:@"%d",score] dimensions:CGSizeMake(290,40) alignment:UITextAlignmentRight fontName:@"Arial" fontSize:16];<br />
		[self addChild:label3 z:5];<br />
		[label3 setRGB:0 :0 :0];<br />
		[label3 setOpacity:200];<br />
		label3.position = ccp(160,start_y-count*step);</p>
<p>		count++;<br />
		if(count == 10) break;<br />
	}</p>
<p>	MenuItem *button1 = [MenuItemImage itemFromNormalImage:@"playAgainButton.png" selectedImage:@"playAgainButton.png" target:self selector:@selector(button1Callback:)];<br />
	MenuItem *button2 = [MenuItemImage itemFromNormalImage:@"changePlayerButton.png" selectedImage:@"changePlayerButton.png" target:self selector:@selector(button2Callback:)];</p>
<p>	Menu *menu = [Menu menuWithItems: button1, button2, nil];</p>
<p>	[menu alignItemsVerticallyWithPadding:9];<br />
	menu.position = ccp(160,58);</p>
<p>	[self addChild:menu];</p>
<p>	return self;<br />
}</p>
<p>- (void)dealloc {<br />
//	NSLog(@"Highscores::dealloc");<br />
	[highscores release];<br />
	[super dealloc];<br />
}</p>
<p>- (void)loadCurrentPlayer {<br />
//	NSLog(@"loadCurrentPlayer");</p>
<p>	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];</p>
<p>	currentPlayer = nil;<br />
	currentPlayer = [defaults objectForKey:@"player"];<br />
	if(!currentPlayer) {<br />
		currentPlayer = @"anonymous";<br />
	}</p>
<p>//	NSLog(@"currentPlayer = %@",currentPlayer);<br />
}</p>
<p>- (void)loadHighscores {<br />
//	NSLog(@"loadHighscores");</p>
<p>	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];</p>
<p>	highscores = nil;<br />
	highscores = [[NSMutableArray alloc] initWithArray: [defaults objectForKey:@"highscores"]];<br />
#ifdef RESET_DEFAULTS<br />
	[highscores removeAllObjects];<br />
#endif<br />
	if([highscores count] == 0) {<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:1000000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:750000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:500000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:250000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:100000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:50000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:20000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:10000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:5000],nil]];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:1000],nil]];<br />
	}<br />
#ifdef RESET_DEFAULTS<br />
	[self saveHighscores];<br />
#endif<br />
}</p>
<p>- (void)updateHighscores {<br />
//	NSLog(@"updateHighscores");</p>
<p>	currentScorePosition = -1;<br />
	int count = 0;<br />
	for(NSMutableArray *highscore in highscores) {<br />
		int score = [[highscore objectAtIndex:1] intValue];</p>
<p>		if(currentScore &#62;= score) {<br />
			currentScorePosition = count;<br />
			break;<br />
		}<br />
		count++;<br />
	}</p>
<p>	if(currentScorePosition &#62;= 0) {<br />
		[highscores insertObject:[NSArray arrayWithObjects:currentPlayer,[NSNumber numberWithInt:currentScore],nil] atIndex:currentScorePosition];<br />
		[highscores removeLastObject];<br />
	}<br />
}</p>
<p>- (void)saveCurrentPlayer {<br />
//	NSLog(@"saveCurrentPlayer");<br />
//	NSLog(@"currentPlayer = %@",currentPlayer);</p>
<p>	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];</p>
<p>	[defaults setObject:currentPlayer forKey:@"player"];<br />
}</p>
<p>- (void)saveHighscores {<br />
//	NSLog(@"saveHighscores");</p>
<p>	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];</p>
<p>	[defaults setObject:highscores forKey:@"highscores"];<br />
}</p>
<p>- (void)button1Callback:(id)sender {<br />
//	NSLog(@"button1Callback");</p>
<p>	Scene *scene = [[Scene node] addChild:[Game node] z:0];<br />
	TransitionScene *ts = [FadeTransition transitionWithDuration:0.5f scene:scene withColorRGB:0xffffff];<br />
	[[Director sharedDirector] replaceScene:ts];<br />
}</p>
<p>- (void)button2Callback:(id)sender {<br />
//	NSLog(@"button2Callback");</p>
<p>	changePlayerAlert = [UIAlertView new];<br />
	changePlayerAlert.title = @"Change Player";<br />
	changePlayerAlert.message = @"\n";<br />
	changePlayerAlert.delegate = self;<br />
	[changePlayerAlert addButtonWithTitle:@"Save"];<br />
	[changePlayerAlert addButtonWithTitle:@"Cancel"];</p>
<p>	changePlayerTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, 45, 245, 27)];<br />
	changePlayerTextField.borderStyle = UITextBorderStyleRoundedRect;<br />
	[changePlayerAlert addSubview:changePlayerTextField];<br />
//	changePlayerTextField.placeholder = @"Enter your name";<br />
//	changePlayerTextField.clearButtonMode = UITextFieldViewModeWhileEditing;<br />
	changePlayerTextField.keyboardType = UIKeyboardTypeDefault;<br />
	changePlayerTextField.returnKeyType = UIReturnKeyDone;<br />
	changePlayerTextField.autocorrectionType = UITextAutocorrectionTypeNo;<br />
	changePlayerTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;<br />
	changePlayerTextField.delegate = self;<br />
	[changePlayerTextField becomeFirstResponder];</p>
<p>	[changePlayerAlert show];<br />
}</p>
<p>- (void)draw {<br />
//	NSLog(@"draw");</p>
<p>	if(currentScorePosition &#60; 0) return;</p>
<p>	glColor4ub(0,0,0,50);</p>
<p>	float w = 320.0f;<br />
	float h = 27.0f;<br />
	float x = (320.0f - w)/2;<br />
	float y = 359.0f - currentScorePosition * h;</p>
<p>	GLfloat vertices[4][2];<br />
	GLubyte indices[4] = { 0, 1, 3, 2 };</p>
<p>	glVertexPointer(2, GL_FLOAT, 0, vertices);<br />
	glEnableClientState(GL_VERTEX_ARRAY);</p>
<p>	vertices[0][0] = x;		vertices[0][1] = y;<br />
	vertices[1][0] = x+w;	vertices[1][1] = y;<br />
	vertices[2][0] = x+w;	vertices[2][1] = y+h;<br />
	vertices[3][0] = x;		vertices[3][1] = y+h;</p>
<p>	glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices);</p>
<p>	glDisableClientState(GL_VERTEX_ARRAY);<br />
}</p>
<p>- (void)changePlayerDone {<br />
	currentPlayer = [changePlayerTextField.text retain];<br />
	[self saveCurrentPlayer];<br />
	if(currentScorePosition &#62;= 0) {<br />
		[highscores removeObjectAtIndex:currentScorePosition];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:0],nil]];<br />
		[self saveHighscores];<br />
		Highscores *h = [[Highscores alloc] initWithScore:currentScore];<br />
		Scene *scene = [[Scene node] addChild:h z:0];<br />
		[[Director sharedDirector] replaceScene:[FadeTransition transitionWithDuration:1 scene:scene withColorRGB:0xffffff]];<br />
	}<br />
}</p>
<p>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {<br />
//	NSLog(@"alertView:clickedButtonAtIndex: %i",buttonIndex);</p>
<p>	if(buttonIndex == 0) {<br />
		[self changePlayerDone];<br />
	} else {<br />
		// nothing<br />
	}<br />
}</p>
<p>- (BOOL)textFieldShouldReturn:(UITextField *)textField {<br />
//	NSLog(@"textFieldShouldReturn");<br />
	[changePlayerAlert dismissWithClickedButtonIndex:0 animated:YES];<br />
	[self changePlayerDone];<br />
	return YES;<br />
}</p>
<p>@end</p>
<p>------------------------------------------------</p>
<p>ok, i know that Sprite is CCSprite and AtlasSpriteManager is CCSpriteBatchNode, thats not the problem.<br />
but the - (void)button1Callback:(id)sender and - (void)changePlayerDone just do not work.</p>
<p>i changed them to this:</p>
<p>--------------------------------------<br />
- (void)button1Callback:(id)sender {<br />
    //	NSLog(@"button1Callback");</p>
<p>	CCScene *scene = [[CCScene node] addChild:[Game node] z:0];<br />
	CCTransitionScene *ts = [CCTransitionFade transitionWithDuration:0.5f scene:scene withColorRGB:0xffffff];<br />
	[[CCDirector sharedDirector] replaceScene:ts];<br />
}<br />
--------------------------------------</p>
<p>and this:</p>
<p>--------------------------------------<br />
- (void)changePlayerDone {<br />
	currentPlayer = [changePlayerTextField.text retain];<br />
	[self saveCurrentPlayer];<br />
	if(currentScorePosition &#62;= 0) {<br />
		[highscores removeObjectAtIndex:currentScorePosition];<br />
		[highscores addObject:[NSArray arrayWithObjects:@"tweejump",[NSNumber numberWithInt:0],nil]];<br />
		[self saveHighscores];<br />
		Highscores *h = [[Highscores alloc] initWithScore:currentScore];<br />
		CCScene *scene = [[CCScene node] addChild:h z:0];<br />
		[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1 scene:scene withColorRGB:0xffffff]];<br />
	}<br />
}<br />
--------------------------------------</p>
<p>but it doesn't work -.-<br />
can someone pls say me, how to change the methods or/and where my mistakes are?
</p></description>
		</item>
		<item>
			<title>nffdiogosilva on "[SpaceManager] EXEC_BAD_ACCESS When Touching a sprite that has a collision"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29120#post-143467</link>
			<pubDate>Thu, 09 Feb 2012 16:54:46 +0000</pubDate>
			<dc:creator>nffdiogosilva</dc:creator>
			<guid isPermaLink="false">143467@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello there. I'm new to Cocos2D and still giving the first steps. But, i'm having this bug:</p>
<p>Here's the code:</p>
<blockquote><p>
-(void) removeAndMaybeFreeShape:(cpShape*)shape freeShape:(BOOL)freeShape<br />
{</p>
<p>if (shape-&#62;body-&#62;m == STATIC_MASS)<br />
cpSpaceRemoveStaticShape(_space, shape);<br />
else<br />
cpSpaceRemoveShape(_space, shape);</p>
<p>//Make sure it's not our static body<br />
if (shape-&#62;body != &#38;_space-&#62;staticBody)<br />
{<br />
//Checking if this body is shared....!<br />
BOOL shared = NO;</p>
<p>//anyone else have this body?<br />
for(cpShape *sh = shape-&#62;body-&#62;shapesList; sh &#38;&#38; !shared; sh=sh-&#62;next)<br />
shared = (sh != shape);</p>
<p>//if not then get rid of it<br />
if (!shared)<br />
[self removeAndMaybeFreeBody:shape-&#62;body freeBody:freeShape];<br />
}</p>
<p>if (freeShape)<br />
cpShapeFree(shape);<br />
}</p>
</blockquote>
<p>I have a body that is colliding ("eating") with another one. But the user might press him for some reason, and if that happens that app crashes sayin': EXEC_BAD_ACCESS, on this line:</p>
<blockquote><p>
if (shape-&#62;body-&#62;m == STATIC_MASS)</p>
</blockquote>
<p>What should i do to prevent the body of being released if it is on a collision?</p>
<p>P.S.: Sorry for posting something that has already a thread but nobody would answer me.
</p></description>
		</item>
		<item>
			<title>Japps on "Need help with basics.. draw sprite on multiple locations"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28970#post-142785</link>
			<pubDate>Sun, 05 Feb 2012 22:06:23 +0000</pubDate>
			<dc:creator>Japps</dc:creator>
			<guid isPermaLink="false">142785@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm new to Cocos2d and Objective c and have trouble to understand a very basic thing with Cocos2d, how to draw the same sprite on multiple locations...</p>
<p>If I have a CCSprite *mySprite, and I want to draw this multiple times it seems I can only add this one time to the layer? Is there no way to for example do mySprite.drawAt(x, y) in the main draw function?
</p></description>
		</item>
		<item>
			<title>SmallMike on "popScene with Transition"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1076#post-6473</link>
			<pubDate>Sun, 02 Aug 2009 23:44:53 +0000</pubDate>
			<dc:creator>SmallMike</dc:creator>
			<guid isPermaLink="false">6473@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is there any way to perform a transition when popping a scene? I can't seem to find any indication of how this might be done. Obviously I can just use replaceScene with a transition, but the push / pop mechanism works really well for how I have my menus/game organized.</p>
<p>- Mike
</p></description>
		</item>
		<item>
			<title>Vanny on "Pointers and properly disposing of objects"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29097#post-143381</link>
			<pubDate>Thu, 09 Feb 2012 01:52:10 +0000</pubDate>
			<dc:creator>Vanny</dc:creator>
			<guid isPermaLink="false">143381@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm getting memory errors and it's probably because of a lack of understanding pointers. I have an instance variable in my game layer that is of a projectile class I made. The projectile has a box2d body and a CCsprite.</p>
<p>So every time a player shoots using an end touch a new projectile is created/assigned to the instance variable, box2d body and all. The reason I assign it to the instance variable is because I need access to that single projectile in other methods to aim and manipulate it for my game. I'm detecting collisions with the projectile, adding to a toDestroy array and removing the ccsprite and body from the scene. Every once in a while I get a memory error when I try to add a new projectile to the layer. Should I not be reusing the instance variable to create objects that remain in the scene?</p>
<p>My error happens occasionally when the game tries to add a new projectile body. Not sure how there is a memory issue creating something new.</p>
<p>Sorry I don't have code it would pretty much be the entire game. I'm more looking for programming concepts.<br />
Any best practices I should follow to create, change and dispose of projectiles?
</p></description>
		</item>
		<item>
			<title>devindazzle on "3d in Cocos2d v2.0"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29049#post-143253</link>
			<pubDate>Wed, 08 Feb 2012 11:55:26 +0000</pubDate>
			<dc:creator>devindazzle</dc:creator>
			<guid isPermaLink="false">143253@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I love how simple it is to create games with Cocos2d. I know it is a 2d engine but I have started to wonder if it would not be possible to actually include 3d models etc in Cocos2d (like done i fx New Super Mario Wii and many other games).</p>
<p>I have seen a few forum topics covering methods to use 3d in Cocos2d but I did not really understand fully what would make it difficult to do 3d in the draw method of a CCNode or similar as it gives access to the GL Context.</p>
<p>Now, if I want to start adding my 3d assets to a cocos2d game I need to know exactly how the GL context is set up and of cause how to reset state it again to ensure proper functionality of cocos2d. Can anyone explain what is actually needed to efficiently enable 3d drawing? What flags are set per default in Cocos2d v2.0 (I assume the depth buffer is not enabled and that orthographic projection is used). Is this true?</p>
<p>Hope to have some pointers from more experienced users :)
</p></description>
		</item>
		<item>
			<title>bobueland on "[Course Announcement] Cocos2d course"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28821#post-141994</link>
			<pubDate>Tue, 31 Jan 2012 13:09:34 +0000</pubDate>
			<dc:creator>bobueland</dc:creator>
			<guid isPermaLink="false">141994@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am designing a complete <a href="http://bobueland.com/cocos2d/?page_id=400">cocos2d course</a>. There is now an <a href="http://bobueland.com/cocos2d/?page_id=450">early bird option</a>  open until the 11:th of Februari 2012.</p>
<p>Thanks<br />
Bob Ueland
</p></description>
		</item>
		<item>
			<title>indy2005 on "Oh Dear: _OBJC_CLASS_$_BombSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29000#post-142964</link>
			<pubDate>Tue, 07 Feb 2012 00:41:05 +0000</pubDate>
			<dc:creator>indy2005</dc:creator>
			<guid isPermaLink="false">142964@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I was just refactoring, moving methods into the appropriate class, and now I cant get past this issue.</p>
<p>Any advice appreciated.  I have cleared the product, and checked for circular includes....</p>
<p>Undefined symbols for architecture i386:<br />
  "_OBJC_CLASS_$_BombSprite", referenced from:<br />
      objc-class-ref in GameLayer.o<br />
ld: symbol(s) not found for architecture i386<br />
clang: error: linker command failed with exit code 1 (use -v to see invocation)</p>
<p>Any advice appreciated..</p>
<p>i
</p></description>
		</item>
		<item>
			<title>aramk on "Efficiency: CCBatchNode vs CCRenderTexture"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29103#post-143396</link>
			<pubDate>Thu, 09 Feb 2012 04:55:41 +0000</pubDate>
			<dc:creator>aramk</dc:creator>
			<guid isPermaLink="false">143396@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My repeating background generates a random terrain with hills placed at random positions across 2000px or so. Is it more efficient to use a CCBatchNode to draw these hills as separate CCSprite objects from the same sprite sheet as the other terrain sprites, or is more efficient to create a large CCRenderTexture and <code>visit</code> the hill at random positions?
</p></description>
		</item>
		<item>
			<title>lerkan on "Load cocos2d scene from a normal UIKit application"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29110#post-143425</link>
			<pubDate>Thu, 09 Feb 2012 10:33:39 +0000</pubDate>
			<dc:creator>lerkan</dc:creator>
			<guid isPermaLink="false">143425@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, </p>
<p>I want to load up a cocos2d scene from my "normal" iPhone application. How would you go about doing that? </p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>breskit on "Am I doing this the right way?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28957#post-142728</link>
			<pubDate>Sun, 05 Feb 2012 09:26:25 +0000</pubDate>
			<dc:creator>breskit</dc:creator>
			<guid isPermaLink="false">142728@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi folks,</p>
<p>Apologies for the long post, but I'm a little stuck!</p>
<p>I just wanted to ask if some of you more experienced folks can tell me if I am coding my project the right way?  I think I have a couple of areas on my project that I may not be handling in the best way, so here's a question on the first.</p>
<p>In my project I'm using Chipmunk for physics and have created a number of "objects" that rotate.  One such example is a cross.  As the cross is a convex shape I have created each arm as a separate shape, so have a total of 4 shapes in my cross object (well, 5 actually as I also have a centre wheel).  These arms are joined by pivot joints around the centre of the cross and are rotated by a simple motor joints.</p>
<p>The touch event on the cross stops/starts it rotating (sets the motor angle to 0/45 accordingly).</p>
<p>My cross object is defined as so:-</p>
<pre><code>@interface _cross : CPSprite &#60;CCTargetedTouchDelegate&#62; {
    CPSprite *arm1;
    CPSprite *arm2;
    CPSprite *arm3;
    CPSprite *arm4;
    CPSprite *wheel;
    float objectMass;
    BOOL isMoving;
    cpConstraint *c1;
    cpConstraint *c2;
    cpConstraint *c3;
    cpConstraint *c4;
    cpConstraint *c5;
    cpConstraint *c6;
    cpConstraint *c7;
    cpConstraint *c8;
    cpConstraint *c9;
    cpConstraint *c10;
    float rotationAngle;
    cpSpace *mSpace;
    cpBody *mGround;

    CGRect rect1;
    CGRect rect2;
    CGRect rect3;
    CGRect rect4;
    CGRect rect5;

}</code></pre>
<p>Touch event for the cross:</p>
<pre><code>-(BOOL) containsTouch:(UITouch*) touch {

    CGPoint locationTouched = [arm1 convertTouchToNodeSpace:touch];
    BOOL isTouched1 = CGRectContainsPoint(rect1, locationTouched);

    locationTouched = [arm2 convertTouchToNodeSpace:touch];
    BOOL isTouched2 = CGRectContainsPoint(rect2, locationTouched);

    locationTouched = [arm3 convertTouchToNodeSpace:touch];
    BOOL isTouched3 = CGRectContainsPoint(rect3, locationTouched);

    locationTouched = [arm4 convertTouchToNodeSpace:touch];
    BOOL isTouched4 = CGRectContainsPoint(rect4, locationTouched);

    locationTouched = [wheel convertTouchToNodeSpace:touch];
    BOOL isTouched5 = CGRectContainsPoint(rect5, locationTouched);

    return isTouched1 &#124;&#124; isTouched2 &#124;&#124; isTouched3 &#124;&#124; isTouched4 &#124;&#124; isTouched5;
}

-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    if (![self containsTouch:touch]) return NO;
    [self toggleMoving:mSpace withGround:mGround];
    return YES;
}</code></pre>
<p>Inside CPSprite I have an update method:</p>
<pre><code>- (void)update {
    self.position = body-&#62;p;
    self.rotation = CC_RADIANS_TO_DEGREES(-1 * body-&#62;a);
}</code></pre>
<p>And my game loop, I call the update for every CPSprite:</p>
<pre><code>-(void) step: (ccTime) delta {
    int steps = 1;
    cpFloat dt = 1.0f/60.0f/(cpFloat)steps;

    for(int i=0; i&#60;steps; i++){
        cpSpaceStep(space, dt);
    }

    for (CPSprite *sprite in batchNode.children) {

        if (sprite) {
            [sprite update];
        }
        if ([sprite isKindOfClass:[rock class]]) {
        }
    } 

    // need to check if level complete
    CGRect image_rect1 = CGRectMake(theEndGate.target.position.x,theEndGate.target.position.y,35,35);

    for (rock *arock in _rocks) {
        float rockw = arock.boundingBox.size.width;
        CGRect image_rect2 = CGRectMake(arock.position.x, arock.position.y, rockw, rockw);

        if(CGRectIntersectsRect(image_rect1, image_rect2)) {
            if (!endGateHit) {
                endGateHit = YES;
                [self addEndgatePD];
                [self endScene:TRUE];
            }
        }

    }
    cpSpaceReindexStatic(space);
}</code></pre>
<p>The CPSprite class allows me to create my CCSprite and Chipmunk body/shape. The touch delegate gives me the targeted touches agains this cross object.<br />
As part of the cross 'init' I calculate the CGRect properties for each piece of the cross so I don't have to calculate this each time I look for a touch.  The position and rotation of these are updated within CPSprite.</p>
<p>The questions I have now are:</p>
<p>1.  In pre-calculating the CGRect for the cross arms, do I need to recalculate these each time for the touch event? I don't think I do as the position/rotation appears to be updated OK.</p>
<p>2. Have I created the arms for the cross in the best way - using separate Chipmunk bodies/sprites/etc, or should I be trying to use a single Chipmunk body in someway for the whole object?</p>
<p>3. Is my main update call within the step: the most efficient way of handling this?  On some levels of my project there are as few as 12 sprites to update, but on others there can me as many as 80+.  Performance/FPS still seem quite good though (around 52fps in most cases).</p>
<p>My problem may just be down to my fat fingers not hitting the right place on the screen to toggle the moving (seems accurate when I use the mouse in simulator). Either that or I'm not calculating/using something correctly.
</p></description>
		</item>
		<item>
			<title>rombos on "CCRotateTo not ending up on final angle?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29106#post-143403</link>
			<pubDate>Thu, 09 Feb 2012 06:48:41 +0000</pubDate>
			<dc:creator>rombos</dc:creator>
			<guid isPermaLink="false">143403@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>in Cocos2D 1.01 I found that a CCRotateTo to 360 (for a full turn) does not end up at 360, but somewhere around 355-360. I would have thought that the CCxxxTo animations in the end somehow make sure that the last call to "update" is with the precise ending value, no matter where the dt's would end up. Now I always have to do a subsequent fix of the final value.<br />
Isn't it implemented in a way that all the CCxxxTo animations assure ending up on the final values?</p>
<p>regards, habitoti
</p></description>
		</item>
		<item>
			<title>rickystone on "CCMenu alignItemsInColumns or alignItemsInRows, how to set padding between item."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29101#post-143394</link>
			<pubDate>Thu, 09 Feb 2012 04:20:22 +0000</pubDate>
			<dc:creator>rickystone</dc:creator>
			<guid isPermaLink="false">143394@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello everybody:</p>
<p>  i want to set padding between CCMenuItemImage in CCMenu when i use alignItemsInColumns API,</p>
<p>  alignItemsInColumns do not have param to set padding, so is there some way to set padding..</p>
<p>  appreciate good suggestion.. thanks..
</p></description>
		</item>
		<item>
			<title>twinkle on "Sequencing actions across multiple sprites"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4688#post-27915</link>
			<pubDate>Thu, 25 Feb 2010 00:46:56 +0000</pubDate>
			<dc:creator>twinkle</dc:creator>
			<guid isPermaLink="false">27915@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am having problem getting a sequence of actions to run across multiple sprites.  Say I have sprite1 and sprite2.  I want to run the following in sequence:  sprite1-move1, sprite1-move2, sprite2-move3.  Tried the following 2 approaches to no avail.  But first, some background:</p>
<p>Since move3 is for a different sprite, I created a method encapsulating it...<br />
<pre><code>-(void)move3 {
  CCSprite* sprite2 = [CCSprite spriteWithFile:@&#34;three.png&#34;];
  sprite2.position = ccp( 430, 230);
  [self addChild:self.sprite2 z:1 tag:123];
  [sprite2 runAction:[CCMoveTo actionWithDuration:1 position:ccp(100,100)]];</code></pre>
<p>and used CCCallFunc to access it...<br />
<code>id move3 = [CCCallFunc actionWithTarget:self selector:@selector(move3)];</code></p>
<p><strong>Approach 1:</strong> Move3 is not called (breakpoint in move3 method not triggered)<br />
<pre><code>id sequence = [CCSequence actions: move1, move2, move3, nil];
[sprite1 runAction:sequence];</code></pre>
<p><strong>Approach 2:</strong> Add move3 directly.  This causes move3 to be run twice.<br />
<pre><code>id sequence = [CCSequence actions:
			   move1, move2,
                          [sprite2 runAction:move3], nil];
[sprite1 runAction:sequence];</code></pre></description>
		</item>
		<item>
			<title>Rob Segal on "Deriving a custom action class from CCMoveBy"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29100#post-143388</link>
			<pubDate>Thu, 09 Feb 2012 03:37:15 +0000</pubDate>
			<dc:creator>Rob Segal</dc:creator>
			<guid isPermaLink="false">143388@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm trying to derive a custom action class from CCMoveBy as I want to override it's update method and call an additional assignable selector but for every instantiation of my class a breakpoint in the update method of the derived class is never hit.  Here's a basic code outline of what I've got.</p>
<p><code><br />
@interface CCMyCustomCCMoveBy : CCMoveBy<br />
{<br />
  SEL mySelector;<br />
}<br />
@end</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "CCMyCustomCCMoveBy.h"</p>
<p>@implementation CCMyCustomCCMoveBy</p>
<p>-(void) update: (ccTime) t &#60;-- this update never runs<br />
{<br />
    [target_ performSelector:mySelector];<br />
    [super update:t];<br />
}<br />
@end<br />
</code></p>
<p>Maybe there's some convention for deriving custom actions I'm missing?  Any input is greatly appreciated.
</p></description>
		</item>
		<item>
			<title>juliusdays on "xcode 4.2 undo redo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22308#post-123768</link>
			<pubDate>Mon, 31 Oct 2011 09:07:07 +0000</pubDate>
			<dc:creator>juliusdays</dc:creator>
			<guid isPermaLink="false">123768@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi..<br />
i have problem when using undo and redo several time on xcode 4.2 and my code changed</p>
<pre><code>case kInstructionGameSkunk :
			leftImage = @&#34;GameSkunk0.png&#34;;
			rightImage = @&#34;GameSkunk1.png&#34;;
			image = @&#34;GameSkunk.png&#34;;
			insImage = @&#34;ISkunk.png&#34;;
			instruction = @&#34;hit The Stink before he sees you&#34;;				

			break;</code></pre>
<pre><code>ckInstructionGameRacooncoonnk :
		        leftImage = @&#34;GameSkunk0.png&#34;;
			rightImage = @&#34;GameSkunk1.png&#34;;
			image = @&#34;GameSkunk.png&#34;;
			insImage = @&#34;ISkunk.png&#34;;
			instruction = @&#34;hit The Stink before he sees you&#34;;

			break;</code></pre>
<p>i confuse about that feature error like that
</p></description>
		</item>

	</channel>
</rss>

