jeanzuck
jeanzuck

Reputation: 716

Background not fit to screen when use Universal image asset (SpriteKit Game)

I'm working for a game scene with SpriteKit in swift. I using Universal images.xcassets for background image. My image dimensions is 2208x1536(px) put on iPhone 3x asset.

It's look good on iPhone But on the iPad my background not fit to screen.

Look good on the iPhone.

enter image description here

But on iPad the background not fit to screen ?

enter image description here

This is my current image asset.

enter image description here

Then, I trying to use Device Specific images.xcassets then put same image on iPad 2x

enter image description here

Now, background already fit to screen on the iPad, But any node coordinations and font size are incorrect.

enter image description here

Here some info of my project.

// scene size & scale mode
scene.size = skView.frame.size
scene.scaleMode = .AspectFill

// background color
self.backgroundColor = SKColor.brownColor()

// add background image
let bg = SKSpriteNode(imageNamed:"bg")
bg.position = CGPoint(x: CGRectGetMidX(self.frame), y: CGRectGetMidY(self.frame))
self.addChild(bg)

And my artwork resolution

enter image description here

How to resolve this problem?

Upvotes: 1

Views: 1835

Answers (1)

elkraneo
elkraneo

Reputation: 119

It seems more an issue with scaleMode of the scene than an asset problem.

Understanding SKScene scaleMode

Scene Scaling Modes

EDIT: try using universal assets @2x - @3x and using bounds instead of frame universal assets used this reference image reference image. This are the results in iphone 6+ iphone 6+ and ipad Air ipad Air

Upvotes: 1

Related Questions