0

i want to change a sprite texture dynamically within animation.here is my code..

smileTexture=[[CCTextureCache sharedTextureCache] addImage:@"Monkey-smile_pad.png"];
angryTexture=[[CCTextureCache sharedTextureCache] addImage:@"Monkey-angry_pad.png"];

and to change the texture of sprite _monkeyone i do this..

_monkeyOne.texture=smileTexture;

and it change the sprite texture successfully.....but it's instant....i want this change within animation duration.....

can anyone help me...??

2 Answers 2

0

Check the cocos2d sprite tests. You will find examples of how to animate your sprites in there.

0

I don't know of a way to do what you are asking right off, but to "cheat" you could make a new sprite directly on top of the old sprite and have the new sprite contain the old texture. Change the underlying texture. Then fade out the top sprite (and remove it) when finished.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.