Reputation: 792
In portrait mode, i created a SKShapeNode
at the position of 0,0
. Yet it seems that it does not appear in the screen at all.
This is the code i am using now
let test = SKShapeNode(rect: CGRectMake(0, 0, 10, 10))
test.fillColor = SKColor.blackColor()
self.addChild(test)
The background colour white, so the shape node will definitely appear if it was on the screen
Yet 0 node appears in the screen?
children.count
returns 1
And this is how i display the scene
override func viewWillLayoutSubviews () {
super.viewWillLayoutSubviews()
if let scene = GameScene.unarchiveFromFile("GameScene") as? 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)
}
}
The SKShapeNode
is drawn, but it is outside the screen?
EDIT 1: I change the scale mode to .AspectFit
, and this is what happened
Is the game forcefully running in landscape although the game is suppose to run in portrait?
Upvotes: 2
Views: 1423
Reputation: 792
Base on @fuzzygoat answer at https://stackoverflow.com/a/24170460/1879382.
Simply open GameScene.sks
, then change the value of x and y to the appropriate value needed.
For me, I used 320 x 568 since i run the game on iPhone 5S
Upvotes: 3