我有一个在 iPad 上正确缩放的精灵动画,但在 iPad 视网膜上显示为一半大小(图像宽 1024 像素,高 20 像素,无论是否在视网膜上,都应该横跨整个屏幕)。我不想为这个动画创建一个 -ipadhd 精灵表,因为文件太大,如果分辨率不是很好,我很好。那么如何强制它在 Retina 设备上放大两倍大小,以便它在屏幕上伸展呢?
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"zapperAnim.plist"];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"zapperAnim.png"];
NSMutableArray *walkAnimFrames = [NSMutableArray array];
NSString *frameName = @"length_0000";
for (int i=0; i<=6; i++) {
[walkAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"%@%d.png", frameName, i]]];
}
CCAnimation *zapAnim = [CCAnimation animationWithSpriteFrames:walkAnimFrames delay:0.05f];
self.zapper = [CCPhysicsSprite spriteWithSpriteFrameName:[NSString stringWithFormat:@"%@0.png", frameName]];
self.zapAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:zapAnim]];
[self.zapper runAction:self.zapAction];