ios - Reset SKScene in Sprite Kit Game -


i working on game.

my 1st screen include 3 buttons : leaderboards, achievements , play.

when tap on play, game scene showed.

let transition = sktransition.doorsopenhorizontal(withduration: 1.0) let next_scene = gamescene(filenamed: "gamescene") next_scene?.scalemode = scalemode view?.presentscene(next_scene!, transition: transition) 

when user dies, want reset game scene, includes erasing , calling didmove function again. want erase game scene , create again.

how can this?

i tried

self.view?.presentscene(nil) let transition = sktransition.doorsopenhorizontal(withduration: 1.0) let next_scene = mainmenu(size: self.size) next_scene.scalemode = scalemode self.view?.presentscene(next_scene, transition: transition) 

but made scene blank 0 nodes.

try doing way: `

  let gamescenetemp = scenename(filenamed: "filename")                 gamescenetemp?.scalemode = self.scalemode                 self.scene?.view?.presentscene(gamescenetemp!, transition: sktransition.doorsclosehorizontal(withduration: 0.0))` 

i create objects not in skscenes files, , if using addchild, shouldn't have problems.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -