Transmission of data between scenarios
-
How am I supposed to pass the variable from one stage to another?
I did it for the view, and I can't figure it out for the scene. ♪ ♪
-
In EndScene, declare an internal variable score
class EndScene: SKScene{ var RestartB : UIButton! internal var score : NSInteger = 0
in the creation of EndScene transfer scores from GameScene
func collisionWithPerson(En: SKSpriteNode, Person: SKSpriteNode){ En.removeFromParent() Person.removeFromParent()
let endScene = EndScene() //не путать endScene и EndScene endScene.score = self.score view?.presentScene(endScene) Scorelbl.removeFromSuperview()
}
For the future, I'd like to read the singlton, I think you're gonna need a lot of data to run through the whole program. http://habrahabr.ru/post/198470/ Good article.