Tag: 精灵试剂盒

SKTextureAtlas加载和内存pipe理

我在SpriteKit上开发一个游戏,并有多个场景每个场景都有3个TextureAtlas在每个TextureAtlas的图像的最小和最大尺寸是60K我的游戏崩溃从内存问题 我在每个场景中所做的是在头文件中定义动作,例如: initialise them in -(id)initWithSize:(CGSize)size Function @interface FirstLevel : SKScene { SKAction *RedBirdAnimation; } 并在实施文件: -(id)initWithSize:(CGSize)size{ if(self=[super initWithSize:size]) {[self setupRedBirdActions];} return self; } -(void)setupRedBirdActions{ SKTextureAtlas *RedBirdAtlas = [SKTextureAtlas atlasNamed:@"RedBird"]; SKTexture *RedBird1 = [RedBirdAtlas textureNamed:@"Redbird_01_iphone.png"]; SKTexture *RedBird2 = [RedBirdAtlas textureNamed:@"Redbird_02_iphone.png"]; SKTexture *RedBird3 = [RedBirdAtlas textureNamed:@"Redbird_03_iphone.png"]; NSArray *atlasTexture = @[RedBird1, RedBird2, RedBird3]; SKAction* atlasAnimation = [SKAction […]