Hi,
You all know how to add an Image to a sprite. But what if we need to change the image of the same sprite? How to do that?
Use the following line of code to change the image of a sprite which already initialized with a sprite.
[sampleSprite setTexture:[[CCTextureCache sharedTextureCache] addImage:@"newImage.png"]];
where sampleSprite is the name of your sprite and newImage is the new image you want to replace with!
🙂