Changing the image of a CCSprite

后端 未结 11 1983
离开以前
离开以前 2020-12-24 12:12

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 qui

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 12:22

    You just need to change the texture of your CCSprite at runtime like this.

    [aSprite setTexture:[[CCTextureCache sharedTextureCache] addImage:@"NewImage.png"]];
    

提交回复
热议问题