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?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
had the same problem and I solved it in my game by not using atlases. So try this example:
When you wish to activate animation do this:
or
Just depends how you declared it. If you need to run animation forever, you can just add line at the end of previous method:
Hope this helps.
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:
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.