i'm trying create replay button game, whenever go game scene, seems if nothing ever stopped. time negative number , game crash. tried....
if timeint < 0 { ////////////// let retryscene = retryscene(size: self.frame.size) self.view?.presentscene(retryscene) self.removeallchildren() self.removeallactions() ///// end game timeint = 45 }
i figured removing children work , resetting time work too. used function updates every second make time work. functions keep going if scene never ended. should do??
all time whant restart game i'am presenting game scene. (starting game scene begining)
it should this
if (node.name == "replaybutton") { var gamescene = gamescene(size: self.size) var transition = sktransition.doorsclosehorizontalwithduration(0.5) gamescene.scalemode = skscenescalemode.aspectfill self.scene!.view?.presentscene(gamescene, transition: transition) }