SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"Sprites"];
NSString *imageName = [NSString stringWithFormat:@"debri_%ld",(long)randomPiece];
SKTexture *temp = [atlas textureNamed:imageName];
SKSpriteNode *debris = [SKSpriteNode spriteNodeWithImageNamed:temp];
debris.position = position;
[self addChild:debris];
我收到警告“SKSpriteNode”我不知道如何修复它。
答案 0 :(得分:2)
方法[SKSpriteNode spriteNodeWithImageNamed:]
接受一个字符串参数,该参数导致错误。你想要:
SKSpriteNode *debris = [SKSpriteNode spriteNodeWithTexture:temp];