I developing a Game on SpriteKit and have Multiple Scenes each Scene has
From 3 TextureAtlas in Minimum
and Maximum Size of an Image in Each TextureAtlas is 60K
my game Crashes From Memory issue
what I do in Each Scene is Defining action in the Header File for Example:
initialise them in -(id)initWithSize:(CGSize)size Function
@interface FirstLevel : SKScene
{
SKAction *RedBirdAnimation;
}
and in Implementation File:
-(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 animateWithTextures:atlasTexture timePerFrame:0.2];
RedBirdAnimation = atlasAnimation;}
is there Something Like Best Practice to Load Texture Atlas in my game
to prevent it from Crashes due to Memory.
i make all SkAction with Nil at the end of Each Skscene
and remove All action from All SkSpriteNode
is there any solution
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…