Search code examples
swiftsprite-kitresolutionscene

handling scene sizes


I am playing with SpriteKit in xCode 6.* using Swift for iOS and am struggling to find out how to implement multiple device versions.

The latest setup of a sprite kit scene uses a .sks file to instantiate the SKScene. This sets the scene size using parameters set in the .sks file.

  1. Does this mean that a different sks file is required per device?

where: iPhone 5s - 568x320 iPhone 6 - 667x375 iPhone 6 plus - 736x414

  1. How would I ensure the correct sks file was loaded for each device in the ViewController, i'm taking a stab at UIDevice and a conditional?

  2. How does this affect multiple levels, Would it be one .sks per level per device?


Solution

  • Nope. Use one sks file and allow it to scale on the other devices. Check out SKScene's scaleMode property to see your options.

    You may have some other adjustments to make in code based on screen size, but this should be your starting point, with a single sks file.