简体   繁体   中英

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.

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...
    }];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM