Tongyue
Tongyue

Reputation: 23

how to create a loading screen for sprite-kit game

I want to create a loading screen which can actually load the whole project in Xcode. I have no idea for now how to do it. Hope you can help.

Upvotes: 0

Views: 995

Answers (1)

sangony
sangony

Reputation: 11696

I am taking a guess that you might be referring to loading one or numerous SKTextureAtlas. If so, then you can try this code:

NSLog(@"start loading...");
SKTextureAtlas *atlas1 = [SKTextureAtlas atlasNamed:MyAtlas_1];
SKTextureAtlas *atlas2 = [SKTextureAtlas atlasNamed:MyAtlas_2];
SKTextureAtlas *atlas3 = [SKTextureAtlas atlasNamed:MyAtlas_3];
[SKTextureAtlas preloadTextureAtlases:[NSArray arrayWithObjects: atlas1, atlas2, atlas3, nil] withCompletionHandler:^{
        NSLog(@"loading done...");
        // loading is done so do whatever you need to here...
    }];

Upvotes: 1

Related Questions