I am presenting a Game Controller/Game Scene programmatically from a View Controller (which passes a difficulty
string to it) like so :
class GameController: UIViewController {
var difficulty: String!
override func loadView() {
self.view = SKView(frame: UIScreen.main.bounds)
}
override func viewDidLoad() {
super.viewDidLoad()
let skView = self.view as! SKView
let scene = GameScene(size: view.frame.size)
// Set the scale mode to scale to fit the window
scene.scaleMode = .aspectFill
scene.difficulty = difficulty
// Present the scene
skView.presentScene(scene)
skView.ignoresSiblingOrder = true
}
}
However when the scene appears on the screen, all the content is "zoomed in" (SKSpriteNode
s, SKLabel
s, etc.)
Does anyone have an idea about how to solve this?
Many thanks in advance.
PS: presenting via the SKS works OK, there is just a problem of SKLabel
positioning on iPad. The problem with this method is that I haven't been able to find how to pass my custom variable difficulty
to the scene via the SKS even though I changed its custom class to mine in the Storyboard so that should do too.