我是 cocos2d 的初学者,但我在 Objective-C 和 iphoneSdk 方面有一些经验。但是我的应用程序中有一个问题,我无法弄清楚错误是什么..
我有一个 CCLayer (Anime),它向玩家显示一个小动画,然后它启动另一个 CCLayer (Level):
日本动画片:
-(id) init{
if( (self=[super init])) {
CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"Anime.plist"];
CCSprite * backgound = [CCSprite spriteWithSpriteFrameName:@"Back.png"];
backgound.anchorPoint=ccp(0,0);
[self addChild:backgound z:-1];
CCSprite *body = [CCSprite spriteWithSpriteFrameName:@"Body1.png"];
[self addChild:body z:0];
CCSprite *bMoved = [CCSprite spriteWithSpriteFrameName:@"Gigante1.png"];
[self addChild:bMoved z:1];
NSMutableArray *nuvemAnim = [[NSMutableArray alloc] init];
for (int i = 1; i < 41; i++) {
NSString *frameNames = [NSString stringWithFormat:@"Gigante%i.png",i];
[nuvemAnim addObject:[[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:frameNames]];
}
CCAnimation *gigAnim = [CCAnimation animationWithFrames:nuvemAnim delay:1.0f/24.0f];
CCAnimate* animate = [CCAnimate actionWithAnimation:gigAnim];
[bMoved runAction:[CCSequence actions:
[CCDelayTime actionWithDuration:1],
animate,
[CCDelayTime actionWithDuration:1],
[CCCallFunc actionWithTarget:self selector:@selector(changeCCScene)],
nil]];
}
return self;
在 Level I 中,使用 CCSpriteFrameCache 来创建角色的动画,
等级:
-(id) init{
if( (self=[super init])) {
self.isTouchEnabled=YES;
CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"Level3.plist"];
CCSprite * backgound = [CCSprite spriteWithSpriteFrameName:@"Fundo9.png"];
backgound.anchorPoint=ccp(0,0);
[self addChild:backgound z:-1];
CCSprite man = [CCSprite spriteWithSpriteFrameName:@"Man1.png"];
[self man z:0];
eAnim = [[NSMutableArray alloc] init];
for (int i = 2; i < 178; i++) {
NSString *frameNames = [NSString stringWithFormat:@Man%i.png",i];
[eAnim addObject:[[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:frameNames]];
}
但在控制台中给我这种类型的错误对于所有帧都无限
2012-04-03 23:37:51.987 GigV1[1432:10a03] cocos2d: WARNING: an alias with name Man12.png already exists
2012-04-03 23:37:51.988 GigV1[1432:10a03] cocos2d: WARNING: an alias with name Man155.png already exists
任何想法为什么会发生这种情况?
谢谢