2
我的问题是,每当我改变精灵的质感,新的纹理会保留原来的精灵的纹理大小。问题与的Texture2D迁移到CCTexture2D(设置CCSprite纹理)
我有这样的代码:
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];
新精灵取决于原始精灵的尺寸被拉伸或压缩。 如果原始精灵较大,新的纹理被拉伸。
当我使用cocos2d的V0.8
我在做什么错了,我没有这个问题?
的'setTextureRect'调用是一个神奇的东西,它使这项工作。没有它,你的新的纹理可以,如果你的精灵应用了一个自定义的比例因子被可怕的扭曲。 – aroth 2011-08-26 00:41:10