我正在使用SpriteKit開發通用遊戲(iPhone和iPad),並且我有背景大小問題。 我爲1136x852尺寸的iPhone設備創建了圖像大小2048x1536以及更多圖像,並且仍然在iPhone上裁剪背景。 我該如何解決它?通用應用背景SpriteKit
let screenHeight = screenSize.size.height
//Backgorund
var dayBackground = SKSpriteNode(imageNamed:"BackgroundDay")
dayBackground.zPosition = -1
dayBackground.position = CGPoint(x:size.width/2, y:size.height/2)
dayBackground.anchorPoint = CGPointMake(0.5, 0.5)
dayBackground.size = self.frame.size
GameViewController:
if let scene = GameScene(fileNamed:"GameScene") {
// Configure the view.
let skView = self.view as! SKView
skView.showsFPS = true
skView.showsNodeCount = true
/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill
skView.presentScene(scene)
}
個
@ 1X尺寸2048×1536是和@ 3X是1136x852 感規模.AspectFill
與.ResizeAll
它不喜歡我想要什麼SKSprtieNode的位置。 謝謝!
我試圖將圖片拆分爲部分,但仍然被裁剪 我認爲是因爲iPhone 6 plus屏幕尺寸爲736x414,場景尺寸爲1024x768,如果我將場景更改爲當前設備,我需要定位每個屏幕的精靈
看看這個:http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions – Whirlwind
我看到所有的遊戲使用相同的圖像的所有大小我怎麼能通過屏幕縮放尺寸? – user1569766