Sprite Kit animateWithTextures lags

前端 未结 2 1661
粉色の甜心
粉色の甜心 2021-01-07 05:07

I\'m using texture atlases in my Sprite Kit game. I\'m creating SKTextureAtlas object and store it\'s textures in array for each animation. So when I need some

2条回答
  •  太阳男子
    2021-01-07 05:25

    I am sure there are few ways to get around this. What you need to do is to preload an atlases before your gameplay actually start. Just show a loading screen at the beginning of the game and preload your atlases.

    You may try with + preloadTextureAtlases:withCompletionHandler:

    [SKTextureAtlas preloadTextureAtlases:textureAtlasesArray withCompletionHandler:^{ /*Game Start*/}];
    

    Another way to implement resource loading before everything else (and keep everything in memory) is described here in Adventure game example

    For more details about loading assets asynchronously take a peek into code which can be downloaded from the link above.

提交回复
热议问题