Reputation: 536
Main menu looks like this.
When i press start code below changes the scene.
let newScene = LevelScene(size: self.scene!.size)
let transition = SKTransition.revealWithDirection(SKTransitionDirection.Up, duration: 1)
newScene.scaleMode = SKSceneScaleMode.AspectFill
self.scene!.view!.presentScene(newScene, transition: nil)
And after I return to the main menu it looks like this
So, as you can see, sprites just disappears. I can't come up with a reason for this to happen.
Upvotes: 1
Views: 823
Reputation: 1
I had the same problem with sprites disappearing and after changing the zPositions of all my sprites and background I still wasn't able to solve it.
I ended up just redeclaring the scene inside my restartButton:
var scene = SKScene(fileNamed: "GameScene")
scene?.scaleMode = .aspectFill
view!.presentScene(scene)
And that worked for me.
Upvotes: 0
Reputation: 599
Are you doing,
self.addChild(...)
self.addChild(...)
in your didMoveToView method? Another possible problem might be that you are setting the zPosition of the node to less than your background, and / or other nodes.
Upvotes: 2