Я пытаюсь передать свой результат от GameScene до GameOverScene
. Я просто хочу установить текст метки в GameOverScene
с моей переменной Score, которую я передал ей. Я использую это:пройти оценку между сценическим комплектом спрайтов
SKView *spriteView = (SKView *) self.view;
SKScene *currentScene = [spriteView scene];
GameOverScene *gameOverScene = [GameOverScene sceneWithSize:self.frame.size];
[gameOverScene.userData setObject:[currentScene.userData objectForKey:@"score"] forKey:@"score"];
[self.view presentScene:gameOverScene transition:[SKTransition doorsCloseHorizontalWithDuration:1]]; // animation
Как получить доступ к переменной оценка сейчас в моей GameOverScene?
Спасибо за любые ответы.
EDIT:
Хорошо у меня есть переменная Int Score; , Как подключить [email protected]"score"
к этой переменной?
EDIT2:
[score setText:[NSString stringWithFormat:@"Score: %@", [self.userData valueForKey:@"score"]]];
С этими словами я Score: (null)
http://stackoverflow.com/questions/18885490/spritekit-passing-data-between-scenes –