2
votes

Im making a game with swift and spriteKit with xcode 6.1.

My problem is that, when I run the game on the iPhone 6 or iPhone 6+ the scene/images dont resize properly

game image

I have this on my GameViewController

// Configure the view.
let skView = view as SKView
skView.multipleTouchEnabled = false

// Create and configure the scene.
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .AspectFill

// Present the scene.
skView.presentScene(scene)

And this on my GameScene

override init(size: CGSize) {
 super.init(size: size)

 anchorPoint = CGPoint(x: 0.5, y: 0.5)

 let background = SKSpriteNode(imageNamed: "Background")
 addChild(background)
}

I have tried all the scale modes but they dont seem to work. I hope someone can tell me what is going on

1
Do you have the launch images for iPh6 and iPh6+? - TonyMkenu

1 Answers

1
votes

The size of the scene is being set to the size of the view in

scene = GameScene(size: skView.bounds.size)

so it is only the images in the scene that are too small to fill the view.

Make these changes to your GameViewController:

if you set the size of the scene to the size of the background image:

scene = GameScene(size: CGSize(width: backgroundImageWidth, height: backgroundImageHeight))

(replace backgroundImageWidth and backgroundImageHeight with actual values) then set the scene's scale mode to fill the view:

scene.scaleMode = .Fill

(this may make the scene look stretched, you could use other scale modes)