Search code examples
cocos2d-iphone

Changing the image of a CCSprite


I have created a number of CCSprites using spriteWithFile.

How do I change the image for the sprite during runtime?

I need to change a few sprites images quite regularly.


Solution

  • CCTexture *tex = [CCTexture textureWithFile:fileName];
    self.texture = tex;