我的问题是每当我更改精灵的纹理时,新纹理将保留原始精灵纹理的大小.
我有这个代码:
mySprite = [CCSprite spriteWithFile:@"mySprite.png"]];
...
// change current stage here
CCTexture2D *newTexture=[[[CCTexture2D alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"stage number %d.png",currentStageNumber]]]autorelease];
[mySprite setTexture:newTexture];
Run Code Online (Sandbox Code Playgroud)
新的精灵被拉伸或压缩,具体取决于原始精灵的大小.如果原始精灵较大,则会拉伸新纹理.
当我使用cocos2d v0.8时,我没有遇到这个问题
我究竟做错了什么?