![]()
[[CCTextureCache sharedTextureCache] addImage: @"still.png"];
但是,由于某种原因,我总是以失真的形象出现.这很可能是因为我的图像的分辨率不一样,但是对于这个应用程序来说,它们不能具有相同的分辨率.如何更改sprite的图像,而不必经历复杂的制作spriteheet或动画或其中任何一个的过程.
解决方法urSprite = [CCSprite spriteWithfile:@"one.png"];urSprite.position = ccp(240,160);[self urSprite z:5 tag:1];// Changing the image of the same sprite[urSprite setTexture:[[CCTextureCache sharedTextureCache] addImage:@"two.png"]];总结
以上是内存溢出为你收集整理的xcode – 如何在cocos2d中简单地更改sprite的图像?全部内容,希望文章能够帮你解决xcode – 如何在cocos2d中简单地更改sprite的图像?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)