Tag Archives: CCTexture2D

How to dynamically change image in a sprite in cocos2D iphone?

By | December 24, 2010

//Dynamically change the sprite image…… //my_sprite is a CCSprite already initialized with spriteWithFile. [[CCTextureCache sharedTextureCache] removeTexture:[self.my_sprite texture]; CCTexture2D *tex = [[CCTextureCache sharedTextureCache] addImage:@”new_image.jpg”]; [my_sprite setTexture:tex];