<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<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; Tag: sprite - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/sprite</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Sat, 31 Jul 2010 07:57:28 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</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/tags/sprite/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>nirmal on "call seperate Actions on single sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8325#post-48404</link>
			<pubDate>Fri, 30 Jul 2010 12:49:43 +0000</pubDate>
			<dc:creator>nirmal</dc:creator>
			<guid isPermaLink="false">48404@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi I'm having problem in calling seperate actions on single sprite.&#60;br /&#62;
In my game, in beginning person is walking then after some time he is falling down.&#60;br /&#62;
So i have made two seperate actions walkAction and fallAction. but when i call walkperson or fallperson seperately,it's working fine..but when i call walkperson then after sometime if i call fallperson then it won't run and application crashes without error log..and yeah if i stop action then it also gives me error..&#60;/p&#62;
&#60;p&#62;Below is code :&#60;/p&#62;
&#60;p&#62;CCSprite *boy = [CCSprite spriteWithFile:@&#34;wineBoyBody.png&#34;];&#60;br /&#62;
boy.position = ccp(250,170); &#60;/p&#62;
&#60;p&#62;id walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];&#60;/p&#62;
&#60;p&#62;id fallAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:fallAnim restoreOriginalFrame:NO]];&#60;/p&#62;
&#60;p&#62;[boy runAction:walkAction];&#60;/p&#62;
&#60;p&#62;Then using scheduler , I call&#60;/p&#62;
&#60;p&#62;[boy runAction:fallAction];&#60;/p&#62;
&#60;p&#62;Now , wht i have to do ?&#60;/p&#62;
&#60;p&#62;Thanks !
&#60;/p&#62;</description>
		</item>
		<item>
			<title>spaceghost on "sprite jumping in direction of accelerometer tilt"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1829#post-11444</link>
			<pubDate>Sat, 12 Sep 2009 14:28:40 +0000</pubDate>
			<dc:creator>spaceghost</dc:creator>
			<guid isPermaLink="false">11444@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;hello, first let me say that cocos2d has been a great bridge from AS3 to Obj-C programming and very helpful in getting our games projects off the ground.  thanks to everyone involved in bringing this to the dev community!&#60;/p&#62;
&#60;p&#62;anyway, I'm trying a simple game action where a sprite is jumping straight up and down (in landscape aspect)... using either JumpBy or MoveBy... and then when the phone is tilted either right or left, the sprite's x position should move in that direction.&#60;/p&#62;
&#60;p&#62;isAccelerometerEnabled is set to yes, and I know it's working because the callback function also changes the sprite rotation, but making any changes to sprite.position in the callback do nothing... and the sprite just keeps jumping straight up and down.&#60;/p&#62;
&#60;p&#62;any ideas on getting this together would be most helpful!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Enivid Games on "Graphics for iPhone 4 and older iPhones"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8118#post-47291</link>
			<pubDate>Thu, 22 Jul 2010 15:02:46 +0000</pubDate>
			<dc:creator>Enivid Games</dc:creator>
			<guid isPermaLink="false">47291@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I haven't been able to find the answer anywhere for this, so maybe someone can give me an idea of what to do or where to look.  I am sorry if this question has already been addressed, but I have not seen the answer anywhere.&#60;/p&#62;
&#60;p&#62;Question:&#60;br /&#62;
I know that the iPhone 4 can take lower res graphics and display them correctly automatically.  I would like to create high res graphics for the iPhone 4, but by making higher res graphics the older iPhones will have a problem displaying the graphics, right?  Will I have to create 2 sets of graphics for my games for now on?&#60;/p&#62;
&#60;p&#62;Thank you!&#60;br /&#62;
Jason
&#60;/p&#62;</description>
		</item>
		<item>
			<title>roli on "Moving and rotating a sprite with Joystick"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7740#post-45284</link>
			<pubDate>Thu, 08 Jul 2010 14:27:04 +0000</pubDate>
			<dc:creator>roli</dc:creator>
			<guid isPermaLink="false">45284@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I am having a little trouble implementing a Joystick into my game. It is something similar to geometry wars or light wars (if you want a specific iPhone title). So you move the ship in space with one Joystick (I am using the Joystick class that comes with cocos). Now the problem is how to actualy translate the data provided by the Joystick into a sprite movement. I managed to do something with rotation:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;-(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
	if ([gamepad touchesMoved:touches withEvent:event] == YES)
	{
		CGPoint point = [gamepad getCurrentDegreeVelocity];
		NSLog(@&#38;quot;x = %f Y = %f&#38;quot;,point.x, point.y);
		id rotate = [CCRotateTo actionWithDuration:(10/point.y) angle:point.x];
		[(CCSprite *)[self getChildByTag:0] runAction:rotate];
	}
	return YES;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I think that it is something like what I want (I can't test it on the actual device because I can't install it onto a device with iPhone OS 3.0 - I am using iPhone SDK 4). But now I am having trouble actualy moving the sprite in the direction of the rotation.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>nirmal on "Call same sequence of actions on multiple sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8143#post-47408</link>
			<pubDate>Fri, 23 Jul 2010 06:32:54 +0000</pubDate>
			<dc:creator>nirmal</dc:creator>
			<guid isPermaLink="false">47408@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi, I'm having problem in calling same sequence of actions on multiple sprite.&#60;br /&#62;
This is my code:&#60;br /&#62;
	id move = [CCMoveBy actionWithDuration:3.0 position:ccp(100,5)];&#60;br /&#62;
	id scalePerson = [CCScaleTo actionWithDuration:3.0 scale:0.2];&#60;br /&#62;
	id action1 = [CCSpawn actions:move,scalePerson,nil];&#60;/p&#62;
&#60;p&#62;	[sprite1 runAction:action1];&#60;br /&#62;
	[sprite2 runAction:action1];&#60;/p&#62;
&#60;p&#62;With above code ,I can see animation on the last sprite (sprite2) but can't see the animation of sprite1.&#60;/p&#62;
&#60;p&#62;Are there other options? Any suggestions on how to do this otherwise?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Zach Winkler on "Sprite collision with rotation problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1142#post-6843</link>
			<pubDate>Wed, 05 Aug 2009 19:45:36 +0000</pubDate>
			<dc:creator>Zach Winkler</dc:creator>
			<guid isPermaLink="false">6843@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I have 2 sprites that I am checking to see if they collide. When the sprites are created I rotate them -150 degrees so they are pointing in the right direction but when I put them near each other, it appears that they are checking for collision as if they were still in the starting position. I am wondering how to fix this so their rects rotate to the same position.&#60;/p&#62;
&#60;p&#62; I tried:&#60;br /&#62;
CGRectApplyAffineTransform(rect2, CGAffineTransformMakeRotation(-150.0f));&#60;br /&#62;
but it still isnt lined up right.&#60;/p&#62;
&#60;p&#62;Any ideas on how to fix this? Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thallid on "Sprite not beeing added from another class(object)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8133#post-47360</link>
			<pubDate>Fri, 23 Jul 2010 00:23:53 +0000</pubDate>
			<dc:creator>thallid</dc:creator>
			<guid isPermaLink="false">47360@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi, i'm having a little problem here and i cant figure out whats wrong. I'm using cocos 0.99.4 &#60;/p&#62;
&#60;p&#62;I have a simple setup. A CCLayer-subclass, in it's init-method I initialize a CCSpriteSheet and add it as child to the layer.&#60;/p&#62;
&#60;p&#62; `&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;- (id)init {
...
enemySprites = [CCSpriteSheet spriteSheetWithFile:@&#38;quot;rock1.png&#38;quot;];
enemies = [[NSMutableDictionary alloc] init];
[self addChild:enemySprites z:3];
...&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Now I am trying to add a new sprite to this sheet from my ControllerClass:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;NSArray *allEnemies = [[GameController sharedGameController] enemies];
        CCSpriteSheet *enemiesSpriteSheet = baseViewLayer.enemySprites;
        NSMutableDictionary *layerEnemies = baseViewLayer.enemies;
        for (Enemy *enemy in allEnemies) {
            CCSprite *enemySprite = [layerEnemies objectForKey:[NSNumber numberWithInt:enemy.ID]];
            if (CGRectContainsPoint(viewPort, enemy.position)) {

                if (enemySprite == nil) {
                    enemySprite = [CCSprite spriteWithSpriteSheet:enemiesSpriteSheet rect:CGRectMake(0, 0, 64, 32)];
                    [enemiesSpriteSheet addChild:enemySprite z:3];
                    [layerEnemies setObject:enemySprite forKey:[NSNumber numberWithInt:enemy.ID]];
                }

                enemySprite.position = [self viewPortCoordinatesWithPoint:enemy.position];
                enemySprite.rotation = enemy.rotation;

            }
            else {
                if (enemySprite != nil) {
                    [enemiesSpriteSheet removeChild:enemySprite cleanup:YES];
                    [layerEnemies removeObjectForKey:[NSNumber numberWithInt:enemy.ID]];

                }
            }

    }&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The enemiesSpriteSheet is the sheet from the Layer. The dictionairy is to connect the modelobject to the sprites.&#60;/p&#62;
&#60;p&#62;But for some reason, the sprite does not show when i start the app. Other sprites added directly in the layers init method are shown properly. Does anyone see why? Drives me crazy! :) thanks alot&#60;/p&#62;
&#60;p&#62;ps: if i use the same part of code directly in the layer's init-method it works...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>calsmith on "Touch event on rotating sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8035#post-46798</link>
			<pubDate>Mon, 19 Jul 2010 12:16:47 +0000</pubDate>
			<dc:creator>calsmith</dc:creator>
			<guid isPermaLink="false">46798@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi, I have tried every possible method of sprite touch detection I can find and &#60;strong&#62;none of them&#60;/strong&#62; seem to work with sprites that have rotated&#60;/p&#62;
&#60;p&#62;my code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;//add circle sprite hit zone (this is what I need touch detection for)
		circleHitZone = [CCSprite spriteWithFile:@&#38;quot;circle_10_hitzone.png&#38;quot;];
		circleHitZone.anchorPoint = ccp(0,-0.9);//this is probs messing it up
		circleHitZone.position = ccp(winSize.width /2 , winSize.height/2);
		circleHitZone.color = ccc3(150,10,5);
		[self addChild:circleHitZone];

		//start rotations
		id rotHit = [CCRotateBy actionWithDuration:20 angle:360];
		id infinRotateHit = [CCRepeatForever actionWithAction: [CCSequence actions: rotHit, nil]];
		[circleHitZone runAction:infinRotateHit];&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I'm trying to detect when 'circleHitZone' is tapped but all methods either don't work at all or work when I tap the anchor point&#60;br /&#62;
I have tried creating a sprite that follows the circleHitZone but it just goes to the anchor point as well :(&#60;/p&#62;
&#60;p&#62;If anyone has &#60;em&#62;any&#60;/em&#62; ideas please help me out, anything is appreciated&#60;br /&#62;
Thanks.&#60;/p&#62;
&#60;p&#62;PS. screenshot of app scene (brown segment is circleHitZone) -&#38;gt; &#60;a href=&#34;http://cl.ly/e770911a8c6c022fb6e5&#34; rel=&#34;nofollow&#34;&#62;http://cl.ly/e770911a8c6c022fb6e5&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>karnak on "Is CCAnimation and CCSprite setDisplayFrame the best way to manually animate?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8038#post-46817</link>
			<pubDate>Mon, 19 Jul 2010 16:29:00 +0000</pubDate>
			<dc:creator>karnak</dc:creator>
			<guid isPermaLink="false">46817@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I'm new to game development and I'm trying to manually animate and positionate a sprite.&#60;br /&#62;
I already accomplished it changing one of Cocos2D examples.&#60;/p&#62;
&#60;p&#62;Given the following code, what I want to know is: &#60;strong&#62;do I really need CCAnimation, since I'm just changing the frames manually? Is it a simpler/better way?&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Setting frames and animation:&#60;/strong&#62;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;-(id) init
{
	if( (self=[super init]) ) {

		CGSize s = [[CCDirector sharedDirector] winSize];

		CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:@&#38;quot;animations/dragon_animation.png&#38;quot;];

		// manually add frames to the frame cache
		CCSpriteFrame *frame0 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*0, 132*0, 132, 132) offset:CGPointZero];
		CCSpriteFrame *frame1 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*1, 132*0, 132, 132) offset:CGPointZero];
		CCSpriteFrame *frame2 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*2, 132*0, 132, 132) offset:CGPointZero];
		CCSpriteFrame *frame3 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*3, 132*0, 132, 132) offset:CGPointZero];
		CCSpriteFrame *frame4 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*0, 132*1, 132, 132) offset:CGPointZero];
		CCSpriteFrame *frame5 = [CCSpriteFrame frameWithTexture:texture rect:CGRectMake(132*1, 132*1, 132, 132) offset:CGPointZero];

		//
		// Animation using Sprite Sheet
		//
		sprite = [CCSprite spriteWithSpriteFrame:frame0];
		sprite.position = ccp( s.width/2-80, s.height/2);
		sprite.anchorPoint = ccp(0,0);
		[self addChild:sprite];

		NSMutableArray *animFrames = [NSMutableArray array];
		[animFrames addObject:frame0];
		[animFrames addObject:frame1];
		[animFrames addObject:frame2];
		[animFrames addObject:frame3];
		[animFrames addObject:frame4];
		[animFrames addObject:frame5];

		CCAnimation *animation = [CCAnimation animationWithName:@&#38;quot;fly&#38;quot; delay:0.2f frames:animFrames];

		[sprite addAnimation:animation];
		[self schedule:@selector(tick:) interval:1.0/60.0];

	}
	return self;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;strong&#62;Animating and changing location:&#60;/strong&#62;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#define RAW_SPEED 120.0

- (void)tick:(float)dt {
	// Last absolute time
	static double lastTime = 0.0;
	// Absolute time difference from last frame
	double timeDiff = 0.0;
	// Actual absolute time
	double actualTime = CFAbsoluteTimeGetCurrent();

	// Position speed
	static float speed = -RAW_SPEED;
	// New position
	float distanceTraveled = (speed * dt);

	// Change animation frame interval
	double animationInterval = 0.1;
	// Last moved absolute time
	static double lastMoved = 0.0;
	// Actual animation frame
	static int frame = 0;

	// Change sprite animation frame
	if((actualTime - lastMoved) &#38;gt;= animationInterval){
		[sprite setDisplayFrame:@&#38;quot;fly&#38;quot; index:frame%6];
		lastMoved = actualTime;
	}

	// New position for sprite
	sprite.position = ccp(sprite.position.x + distanceTraveled, sprite.position.y);

	// Check boundaries and flip speed and sprite
	if(sprite.position.x + sprite.contentSize.width &#38;gt;= 480) {
		speed = -RAW_SPEED;
		sprite.flipX = NO;
	} 

	if(sprite.position.x &#38;lt;= 0) {
		speed = RAW_SPEED;
		sprite.flipX = YES;
	}	

	timeDiff = actualTime - lastTime;
	lastTime = actualTime;
	NSLog(@&#38;quot;actualTime: %f - timeDiff: %f - Distance: %f - speed: %f\n&#38;quot;, actualTime, timeDiff, distanceTraveled, speed);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mrTortex on "Use Chipmunk body to move sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8010#post-46692</link>
			<pubDate>Sun, 18 Jul 2010 11:16:08 +0000</pubDate>
			<dc:creator>mrTortex</dc:creator>
			<guid isPermaLink="false">46692@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello.&#60;/p&#62;
&#60;p&#62;Very quick question, can I use the location of a Chipmunk physics body to update the location of a CCSprite?  I've tried cpBodyGetPos in a tick method.  I've tried mySprite.position = (cpBodyGetPos(myBody));  I know I'm doing something silly but can't figure it out.&#60;/p&#62;
&#60;p&#62;Also wasn't sure if this was a generic Cocos2D question or a phyiscs question, so feel free to move.&#60;/p&#62;
&#60;p&#62;Any ideas?  Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>forfree on "Hopefully easy quesiton about masking a Sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5329#post-31848</link>
			<pubDate>Sun, 28 Mar 2010 07:18:34 +0000</pubDate>
			<dc:creator>forfree</dc:creator>
			<guid isPermaLink="false">31848@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Ok, so I've been looking into implementing a rectangular mask region over a layer.&#60;/p&#62;
&#60;p&#62;Someone suggested using a RenderTexture, so that's what I've been trying. All I'm wanting to do is move an orb image on a 100x100 RenderTexture so I can see it moving &#34;off&#34; the RenderTexture region. I'm placing the RenderTexture over the game layer. The problem is I can't find a way to reset the RenderTexture, so whenever I move the orb image it doesn't clear it first and I'm left with a &#34;shadow&#34; of the previous image drawn. &#60;/p&#62;
&#60;p&#62;Here's the setup:&#60;br /&#62;
orb = [Sprite spriteWithFile:@&#34;blueOrb.png&#34;];&#60;br /&#62;
[orb setPosition:ccp(50,50)];&#60;br /&#62;
[orb retain];&#60;br /&#62;
test = [RenderTexture renderTextureWithWidth:100.0 height:100.0];&#60;br /&#62;
[test setPosition:ccp(160,240)];&#60;br /&#62;
[self addChild:test z:1];&#60;/p&#62;
&#60;p&#62;Here's what I'm calling in my step function:&#60;br /&#62;
[orb setPosition:ccp(50.0,50.0+y)];&#60;br /&#62;
[test begin];&#60;br /&#62;
[orb visit];&#60;br /&#62;
[test end];&#60;br /&#62;
y+=1;&#60;/p&#62;
&#60;p&#62;Any help or guidance would be much appreciated!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>oscarmk on "Scaling sprites, reversing the scale and getting current content size"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3840#post-23004</link>
			<pubDate>Mon, 11 Jan 2010 23:51:13 +0000</pubDate>
			<dc:creator>oscarmk</dc:creator>
			<guid isPermaLink="false">23004@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I have a Sprite that I am constantly repositioning, and I would like to adjust the scale of the Sprite every time it is repositioned, first I tried ScaleBy, followed by reverse by and then again a new Scale By (so that I can scale based on original form), however is this the &#34;right&#34; way to do this?. &#60;/p&#62;
&#60;p&#62;Additionally how can i get the new width of the sprite?, I noticed even though the image is scaled the width of the contentSize stays the same. &#60;/p&#62;
&#60;p&#62;-Oscar
&#60;/p&#62;</description>
		</item>
		<item>
			<title>andrewBatutin on "IPhone spite problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7929#post-46313</link>
			<pubDate>Thu, 15 Jul 2010 09:57:53 +0000</pubDate>
			<dc:creator>andrewBatutin</dc:creator>
			<guid isPermaLink="false">46313@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;The problem is - when i load game on iphone some sprites are shown, some are not, plus CCBitmapFontAtlas labels and CCMenu button are also not visible and when i tap on the place where button have to be - there is no effect. At simulator it worked just fine. What is the reason of such strange situation?&#60;br /&#62;
IPad aslo works ok.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>stevemack on "Best approach to my game&#039;s design?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7903#post-46177</link>
			<pubDate>Wed, 14 Jul 2010 16:14:45 +0000</pubDate>
			<dc:creator>stevemack</dc:creator>
			<guid isPermaLink="false">46177@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hey guys,&#60;/p&#62;
&#60;p&#62;I've written a simple brick out game.  It works fine, but all of the game code is in GamePlay.m.  I want to make objects for the paddle, ball, bricks, etc. before expanding on the game.  This way GamePlay.m will only have to handle collision detection between objects, score, level, etc.  &#60;/p&#62;
&#60;p&#62;Right now I'm struggling to determine where I should load my sprites and what I should subclass for my objects.  Should I subclass CCSprite or CCNode or another class?  I've looked at some example projects, but I would appreciate it if anyone could provide my with some sample code that implements this model-based programming style, or if anyone could give my any pointers here.&#60;/p&#62;
&#60;p&#62;Thanks in advance!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sunshineDev on "How can I sequentially animate two different sprites?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7847#post-45898</link>
			<pubDate>Mon, 12 Jul 2010 19:43:05 +0000</pubDate>
			<dc:creator>sunshineDev</dc:creator>
			<guid isPermaLink="false">45898@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello everyone,&#60;/p&#62;
&#60;p&#62;I need to have 2 separate sprite animations. The tricky thing I haven't been able to resolve is being able to animate the second sprite, right after the first animation finishes. &#60;/p&#62;
&#60;p&#62;Can somebody please shed some light on this?&#60;/p&#62;
&#60;p&#62;Thanks in advance.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DerekTse on "Help needed to implemented Page Curl Effect of a Sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7744#post-45296</link>
			<pubDate>Thu, 08 Jul 2010 15:17:49 +0000</pubDate>
			<dc:creator>DerekTse</dc:creator>
			<guid isPermaLink="false">45296@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Dear all,&#60;/p&#62;
&#60;p&#62;Currently I am trying to implement the page curl effect of a sprite using the algorithm and source from &#60;a href=&#34;http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling-using.html&#34;&#62;here: &#60;a href=&#34;http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling&#34; rel=&#34;nofollow&#34;&#62;http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling&#60;/a&#62;&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;However, I'm too new to opengl and I'm not able to start. &#60;/p&#62;
&#60;p&#62;Here are the questions in my mind:&#60;br /&#62;
How can I get the vertices matrix of the sprite and calculate the corresponding new vertices?&#60;br /&#62;
How can I draw the new vertices by overriding -(void) draw?&#60;br /&#62;
How can I bind the the texture on both faces?&#60;/p&#62;
&#60;p&#62;Any help would be very much appreciated.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>7thsmith on "Creating a sprite using a property"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7712#post-45134</link>
			<pubDate>Wed, 07 Jul 2010 20:20:24 +0000</pubDate>
			<dc:creator>7thsmith</dc:creator>
			<guid isPermaLink="false">45134@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I am new to cocos2d and programing.  I am trying to load a texture using the property of an object.  Here is the code I am using to call the texture -&#60;/p&#62;
&#60;p&#62;CCTexture2D *cardTexture = [[CCTextureCache sharedTextureCache] addImage:card.imagePath];&#60;/p&#62;
&#60;p&#62;card.imagePath contents a NSString of the file name of the sprite I want to load.  If anyone can help that would be great, or if you need anything else let me know.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JohnM on "Graphics preparing for tmx map"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7702#post-45073</link>
			<pubDate>Wed, 07 Jul 2010 10:01:15 +0000</pubDate>
			<dc:creator>JohnM</dc:creator>
			<guid isPermaLink="false">45073@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;Making graphics for tmx maps can be teddious job.&#60;br /&#62;
Moreover, I have read that some artifacts can happen.&#60;br /&#62;
For example, we have tile size 32x32.&#60;/p&#62;
&#60;p&#62;I have read that graphics picture must be adjusted, so that actuall size will be 34x34 and this one pixel from each side is added to prevent artifacts in game.&#60;br /&#62;
1. How to prepare graphics for tmx map. Is there some easy solution? For example I have graphics in texture 1024x1024. Is there some way to automatically fix it?&#60;br /&#62;
2. Do I have to manually edit each tile in png graphics and add this 1 pixel (so that I copy neighbouring pixels) or there is some automatic way to do it easily. If all has to be done manualy, it is painful process.&#60;br /&#62;
3. This above questions were for game background. What about with sprites that are not part of tmx map graphcis? Are they also need to be fixed same way?&#60;/p&#62;
&#60;p&#62;As far as I understand, this is very painfull process in preparing graphics for the game.&#60;br /&#62;
Could you give some guidance in this and enlight the way how to do it?&#60;/p&#62;
&#60;p&#62;Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hezi on "Parallax Node and Box2d Bodies"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7687#post-44997</link>
			<pubDate>Tue, 06 Jul 2010 22:23:22 +0000</pubDate>
			<dc:creator>hezi</dc:creator>
			<guid isPermaLink="false">44997@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
My Game has a parallax node, to that node i've added a sprite connected to a box2d body.&#60;br /&#62;
when i move the parallax node to create the parallax effect, my sprite moves, but the body stays where i have originally positioned it.&#60;/p&#62;
&#60;p&#62;i've tried moving it by overriding the setPosition on my sprite and by subclassing CCParallaxNode and doing the repositioning there,&#60;br /&#62;
but nothing seems to work. &#60;/p&#62;
&#60;p&#62;any suggestions? thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sambaylus on "CCSpriteSheet help, please!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7626#post-44672</link>
			<pubDate>Sun, 04 Jul 2010 05:14:04 +0000</pubDate>
			<dc:creator>sambaylus</dc:creator>
			<guid isPermaLink="false">44672@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I have different classes containing: &#60;/p&#62;
&#60;p&#62;sheet = [CCSpriteSheet spriteSheetWithFile:@&#34;gameSheet.png&#34;];&#60;br /&#62;
sprite = [CCSprite spriteWithTexture:sheet.texture rect:spriteRect];&#60;br /&#62;
[self addChild:sprite];&#60;/p&#62;
&#60;p&#62;I'm defeating the purpose of the sprite sheet by not adding &#34;sprite&#34; as a child of &#34;sheet,&#34; right?&#60;br /&#62;
If I define a sheet with the same file across many different classes and objects, does cocos2d cache it and return a reference to the same sheet, or does it create new sheets from the same file?&#60;/p&#62;
&#60;p&#62;What I'd like to do is define the sprite sheet in a singleton class, and have other classes add their sprites as children to the singleton's sprite sheet. I'm not really sure how to implement this correctly. Help, please!&#60;/p&#62;
&#60;p&#62;-Thanks,&#60;br /&#62;
Sam
&#60;/p&#62;</description>
		</item>
		<item>
			<title>code206 on "Animating characters using a spritesheet"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7300#post-42788</link>
			<pubDate>Tue, 22 Jun 2010 04:32:06 +0000</pubDate>
			<dc:creator>code206</dc:creator>
			<guid isPermaLink="false">42788@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I'm working on an iphone game that uses lots of different animated shrites which have to be drawn in 4 different directions up, down, left and right.  I've been playing with the new cocos2d .99.3 and I'm finding the way we animate a little more complicated than before.  Here is the current code I have to write for spritesheet animation.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@&#38;quot;animations/grossini.plist&#38;quot;];
		CCSprite *sprite = [CCSprite spriteWithSpriteFrameName:@&#38;quot;grossini_dance_01.png&#38;quot;];
		sprite.position = ccp( 100, 100);

		CCSpriteSheet *spritesheet = [CCSpriteSheet spriteSheetWithFile:@&#38;quot;animations/grossini.png&#38;quot;];
		[spritesheet addChild:sprite];
		[self addChild:spritesheet];

		NSMutableArray *animFrames = [NSMutableArray array];
		for(int i = 1; i &#38;lt; 15; i++) {

			CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@&#38;quot;grossini_dance_%02d.png&#38;quot;,i]];
			[animFrames addObject:frame];
		}

		CCAnimation *animation = [CCAnimation animationWithName:@&#38;quot;dance&#38;quot; frames:animFrames];
		// 14 frames * 0.2sec = 2,8 seconds
		[sprite runAction:[CCRepeatForever actionWithAction: [CCAnimate actionWithDuration:2.8f animation:animation restoreOriginalFrame:NO] ]];&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I thought the whole point of using a spritesheet was so you didn't have to have tons of separate sprite files for animation.  Is there a way to do this where i just tell it what spritesheet to use and then iterate though the frames?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Glnn on "Sprite flip animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7616#post-44583</link>
			<pubDate>Sat, 03 Jul 2010 10:41:09 +0000</pubDate>
			<dc:creator>Glnn</dc:creator>
			<guid isPermaLink="false">44583@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi guys,&#60;/p&#62;
&#60;p&#62;I've been looking around the internet to see if the CCFlipX3D could be applied to sprites. But I found out that wasn't possible.&#60;/p&#62;
&#60;p&#62;I'm trying to make a sprite flip with a 3D animation just like the CCFlipX3D animation. &#60;/p&#62;
&#60;p&#62;Has anyone ever made such an animation, or can I port the animation to sprites..?&#60;/p&#62;
&#60;p&#62;Any help is appreciated.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cheesev on "how to make sprite invisible after action"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6469#post-37791</link>
			<pubDate>Mon, 17 May 2010 16:33:09 +0000</pubDate>
			<dc:creator>cheesev</dc:creator>
			<guid isPermaLink="false">37791@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;hi, &#60;/p&#62;
&#60;p&#62;i want to make sprite invisible after action &#60;/p&#62;
&#60;p&#62;my code:&#60;br /&#62;
 when touch event occur&#60;br /&#62;
{&#60;br /&#62;
 ...&#60;/p&#62;
&#60;p&#62;			waterAction = waterLeftAction; // waterLeftAction is animation!&#60;br /&#62;
			action = [CallFunc actionWithTarget:self selector:@selector(spriteActionFinished:)];&#60;br /&#62;
			[sprite runAction:[Sequence actions:waterAction, action, nil]];&#60;/p&#62;
&#60;p&#62;  ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;after waterLeftAction, below method is called.&#60;/p&#62;
&#60;p&#62;-(void)spriteMoveFinished:(id)sender&#60;br /&#62;
{&#60;br /&#62;
	AtlasSprite *sprite = (AtlasSprite *)sender;&#60;br /&#62;
	sprite.visible = NO;   // Error!!!&#60;br /&#62;
        //sprite.position = ccp(500,500) //  Error!!!&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;what is my problem?&#60;br /&#62;
I want to hide sprite after waterLeftAction&#60;/p&#62;
&#60;p&#62;I need your help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lamfan on "CCSpriteSheet or CCSprite slow down my tile map...."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7472#post-43802</link>
			<pubDate>Mon, 28 Jun 2010 02:50:48 +0000</pubDate>
			<dc:creator>lamfan</dc:creator>
			<guid isPermaLink="false">43802@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I'm making a tile map for my app, but the performance decrease when I use around 150 static tiles.&#60;/p&#62;
&#60;p&#62;Container.m&#60;br /&#62;
for(int i = 0; i&#38;lt; 15; i++){&#60;br /&#62;
  for(int j = 0; j &#38;lt; 9; j++) {&#60;br /&#62;
  Floor *tile = [Floor node];&#60;br /&#62;
  [self addChild:tile];&#60;br /&#62;
  }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;Floor.m&#60;br /&#62;
CCSpriteSheet *sheet = [CCSpriteSheet spriteSheetWithFile:&#34;floor.png&#34;];&#60;br /&#62;
CCSprite *sprite = [CCSprite spriteWithTexture:sheet.texture rect:CGRectMakd(0,0,60,36)];&#60;br /&#62;
[self addChild:sheet];&#60;br /&#62;
[sheet addChild:sprite];
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bizkits on "CCSpriteSheet help"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7456#post-43718</link>
			<pubDate>Sun, 27 Jun 2010 09:21:08 +0000</pubDate>
			<dc:creator>bizkits</dc:creator>
			<guid isPermaLink="false">43718@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello, I'm trying to implement my sprites using a spritesheet that is created by Zwoptex.&#60;br /&#62;
So now I have my spriteSheet.plist and spriteSheet.png I need to implement it in my code.&#60;br /&#62;
What I did was this.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@&#38;quot;spriteSheet.plist&#38;quot;];
	self.spriteSheet = [CCSpriteSheet spriteSheetWithTexture:[[CCTextureCache sharedTextureCache] addImage:@&#38;quot;spriteSheet.png&#38;quot;]];
	[self addChild:_spriteSheet];	

		CGSize winSize = [CCDirector sharedDirector].winSize;
		self.background = [CCSprite spriteWithSpriteFrame:@&#38;quot;background.png&#38;quot;];
		_background.position = ccp(winSize.width/2, winSize.height/2);
		[_spriteSheet addChild:_background];&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;However, it says Incompatible Objective-C types 'struct NSString*', expected `struct CCSpriteFrame*' when passing argument  1 of spriteWithSpriteFrame:' from distinct Objective-C type.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Omegas7 on "CCMenuItem change graphic?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7447#post-43660</link>
			<pubDate>Sat, 26 Jun 2010 23:47:37 +0000</pubDate>
			<dc:creator>Omegas7</dc:creator>
			<guid isPermaLink="false">43660@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Is there a way to change a CCMenuItem object's graphic?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bizkits on "Accelerometer and sprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7397#post-43362</link>
			<pubDate>Fri, 25 Jun 2010 09:49:23 +0000</pubDate>
			<dc:creator>bizkits</dc:creator>
			<guid isPermaLink="false">43362@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hello, I'm trying to implement the accelerometer.&#60;br /&#62;
What I want to do is, I create this sprite and move it using the accelerometer. I have no idea how to implement this, but I have some thoughts.&#60;br /&#62;
I should create the sprite first, and then using the accelerometer connect to the sprite and control it. I'm not sure how to code this, any help would be appreciated! Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Joethemonkey101 on "Loading screen"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7282#post-42672</link>
			<pubDate>Mon, 21 Jun 2010 17:00:29 +0000</pubDate>
			<dc:creator>Joethemonkey101</dc:creator>
			<guid isPermaLink="false">42672@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;How do I make it so everything (like sprites) loads up during the loading screen? I want to do this so that I don't have to use time later in the game to load all the sprites and other objects.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JohnM on "Animation of sprites (pictures)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7238#post-42440</link>
			<pubDate>Sun, 20 Jun 2010 00:16:45 +0000</pubDate>
			<dc:creator>JohnM</dc:creator>
			<guid isPermaLink="false">42440@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I have animation that consist of 15 frames.&#60;br /&#62;
Is it possible to adjust time in miliseconds (timing) between frames? For example, I want to set time between change to next frame (switching to next frame) to lets say 0,05 sec. Is this possible?&#60;br /&#62;
This way I can adjust speed of animation. &#60;/p&#62;
&#60;p&#62;Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jerryco2 on "animation inside a polygon"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7261#post-42567</link>
			<pubDate>Sun, 20 Jun 2010 22:58:58 +0000</pubDate>
			<dc:creator>jerryco2</dc:creator>
			<guid isPermaLink="false">42567@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Is there a way to do image animation inside a polygon? I mean, move image around inside a polygon, if part of the image is outside of polygon border, that part becomes invisible, however still keep the part of image which is inside the polygon visible.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
