我在assets文件夹中有两个图像,如下所示:
backgroundImage = @"background.wood"; backgroundImageLight = @"background.wood.lighting";
assets文件夹中的名称与这些字符串相同.当我尝试加载这些图像时,无论backgroundLight总是加载背景图像.我必须将assets文件夹中的名称和字符串中的名称从“background.wood.lighting”更改为“somedifferentstring”,以便实际加载正确的图像.这是Xcode的错误吗?为什么它为这些不同的字符串加载相同的图像?是否与初期相似?我尝试手动清空缓存,以确保图像没有预加载,但也没有帮助.
更新:
SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:backgroundImage]; background.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame)); background.size = self.frame.size; background.zPosition = background_z_order; SKSpriteNode *backgroundLight = [SKSpriteNode spriteNodeWithImageNamed:backgroundImageLight]; NSLog(@"%@,%@",backgroundImage,backgroundImageLight); backgroundLight.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame)); backgroundLight.size = self.frame.size; backgroundLight.zPosition = background_z_order; [mainView addChild:background]; [mainView addChild:backgroundLight];
更新2:
所有这些加载不同的图像,所以也许它是第二个“.”把它抛出idk:
monster.boss.one monster.fire.redsun monster.lightning.yellowjaw monster.normal.greenslither