雪碧套件animateWithTextures滞后 [英] Sprite Kit animateWithTextures lags

查看:218
本文介绍了雪碧套件animateWithTextures滞后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的雪碧套件游戏使用纹理地图。我创建 SKTextureAtlas 对象并存储它的纹理阵列中的每个动画。所以,当我需要我的英雄一些动画我称之为 animateWithTextures 将其发送相应的数组。有一些滞后,当我开始动画。是否有某种方式顺利启动动画?

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 animation on my hero I call animateWithTextures sending it the corresponding array. There are some lags when I start animations. Is there some way to start animation smoothly?

推荐答案

我相信有几个方法来解决这个问题。你需要做的是preLOAD您的游戏之前地图集真正开始。而就在本场比赛和preLOAD您地图集的开头显示加载屏幕。

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.

您可以用<一试href=\"https://developer.apple.com/library/$p$prelease/ios/documentation/SpriteKit/Reference/SKTextureAtlas/index.html#//apple_ref/occ/clm/SKTextureAtlas/$p$ploadTextureAtlases:withCompletionHandler:\"相对=nofollow> + preloadTextureAtlases:withCompletionHandler:

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

实施高于一切资源加载(并保持在内存中的所有内容)的另一种方法是这里所描述的<一个href=\"https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/$c$cExplainedAdventure/BuildingtheWorld/BuildingtheWorld.html#//apple_ref/doc/uid/TP40013140-CH3-SW2\"相对=nofollow>冒险类游戏的例子

有关加载的资产的详细信息异步采取偷看到code,可以从上面的链接下载。

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

这篇关于雪碧套件animateWithTextures滞后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆