我正在使用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