Kodeco Forums

Video Tutorial: Beginning SpriteKit Part 3: Univesal App Support

Learn how to make your game work on different devices so you'll have one universal app supported on different screen sizes.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3876-beginning-spritekit/lessons/4

Excellent Information. Thank you so much. What should be the image size for portrait only game? Can we calculate the boundaries in a similar way?

I used image size of 1536 X 2048 and i used the following code to create the playableRect

    let maxAspectRatio:CGFloat = 16.0/9.0
    let playableWidth = size.height / maxAspectRatio
    let playableMargin = (size.width-playableWidth)/2.0
    
    playableRect = CGRect(x: playableMargin, y: 0,
                          width: playableWidth, height: size.height)

when i run the code, i was able to see the playable rectangle in all the devices.