<?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; Topic: When changing textures in Sprite, It shows both...</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/3989</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:43:41 +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/topic/3989" rel="self" type="application/rss+xml" />

		<item>
			<title>MikeSz on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-24000</link>
			<pubDate>Fri, 22 Jan 2010 15:17:39 +0000</pubDate>
			<dc:creator>MikeSz</dc:creator>
			<guid isPermaLink="false">24000@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>no. we have used Animation in 0.7.0 and it should also be working in newer releases</p>
<p>here is the code we used, bear in mind it's from 0.7 so you might have to make sme modifications:</p>
<p>// create animation<br />
Animation * someAnim = [Animation animationWithName:@"anim_name" delay:0.0 images:@"image1.png",@"image2.png", nil];</p>
<p>// create sprite<br />
Sprite * spr = [Sprite spriteWithFile:@"image1.png"];<br />
[spr addAnimation:someAnim];<br />
[spr setDisplayFrame: @"anim_name" index:1];</p>
<p>that should switch the image to image2.png
</p></description>
		</item>
		<item>
			<title>agfa555 on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23990</link>
			<pubDate>Fri, 22 Jan 2010 14:12:28 +0000</pubDate>
			<dc:creator>agfa555</dc:creator>
			<guid isPermaLink="false">23990@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I searched all sprite test example but there is nothing about changing textures.<br />
Is the only way of changing the sprite's texture by removing and adding another child???
</p></description>
		</item>
		<item>
			<title>agfa555 on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23975</link>
			<pubDate>Fri, 22 Jan 2010 11:47:09 +0000</pubDate>
			<dc:creator>agfa555</dc:creator>
			<guid isPermaLink="false">23975@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I use normal Sprites.<br />
Have not used SpriteSheet</p>
<p>Here is sample code for changing the texture:</p>
<p>Texture2D *texture = [[Texture2D alloc] initWithImage:[UIImage imageNamed:file]];<br />
[powerBlock setTexture:texture];
</p></description>
		</item>
		<item>
			<title>MikeSz on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23974</link>
			<pubDate>Fri, 22 Jan 2010 11:44:23 +0000</pubDate>
			<dc:creator>MikeSz</dc:creator>
			<guid isPermaLink="false">23974@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>are you using spritesheet or separe images for the sprites ?</p>
<p>well, you probably use separate images</p>
<p>for that I used animations...</p>
<p>Id recommend you to just look into the code samples (sprite test)
</p></description>
		</item>
		<item>
			<title>agfa555 on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23972</link>
			<pubDate>Fri, 22 Jan 2010 11:38:05 +0000</pubDate>
			<dc:creator>agfa555</dc:creator>
			<guid isPermaLink="false">23972@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>That removes the sprite from screen.<br />
I just want to switch the sprite texture but can't seem to get rid of the original one.<br />
HELP!
</p></description>
		</item>
		<item>
			<title>MikeSz on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23908</link>
			<pubDate>Thu, 21 Jan 2010 14:41:03 +0000</pubDate>
			<dc:creator>MikeSz</dc:creator>
			<guid isPermaLink="false">23908@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>[sprite.parent removeChild:sprite];</p>
<p>something like this
</p></description>
		</item>
		<item>
			<title>agfa555 on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23905</link>
			<pubDate>Thu, 21 Jan 2010 14:18:45 +0000</pubDate>
			<dc:creator>agfa555</dc:creator>
			<guid isPermaLink="false">23905@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks.</p>
<p>How do i remove that???<br />
I tried releasing the texture but it crashes.
</p></description>
		</item>
		<item>
			<title>MikeSz on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23903</link>
			<pubDate>Thu, 21 Jan 2010 14:04:36 +0000</pubDate>
			<dc:creator>MikeSz</dc:creator>
			<guid isPermaLink="false">23903@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>because you dont remove it from the layer / spritesheer probably
</p></description>
		</item>
		<item>
			<title>agfa555 on "When changing textures in Sprite, It shows both..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3989#post-23894</link>
			<pubDate>Thu, 21 Jan 2010 12:55:36 +0000</pubDate>
			<dc:creator>agfa555</dc:creator>
			<guid isPermaLink="false">23894@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I'm trying to figure out why when i change my sprite's texture the old one appears in the lower left corner.<br />
Can't get rid of it.</p>
<p>Thanks in advance
</p></description>
		</item>

	</channel>
</rss>

