0
我正试图实现以下结果。 2 SKSpriteNode
将对象作为子节点添加到占用全宽度的GameScene
。我限制了我的范围,现在不想处理landscape
模式,并且想要根据当前视图大小设置每个背景的height
的大小(50%
)。如何在游戏场景中均匀分割两个SKSpriteNode
override func didMoveToView(view: SKView) {
let background1 = SKSpriteNode()
background1.position = CGPoint(x:0,y:0)
background1.anchorPoint = CGPoint(x:0.0,y:0.0)
background1.size = view.bounds.size
let background2 = SKSpriteNode()
background2.position = CGPoint(x:0,y:0)
background2.anchorPoint = CGPoint(x:0.0,y:0.0)
background2.size = view.bounds.size
self.addChild(background1)
self.addChild(background2)
}
我有一些很难理解position
财产如何工作按照CGPoint
既不SKNode
目前显示为我说话。有谁知道SpriteKit是否提供弹性大小调整功能,以便我不必硬编码CGPoint(x:?,y:?
)的坐标?