ios - sprite kit swift, detecting collision for game over -


i making first game. have collision function ballcollidewithwall(_:ball:) called expected, game on scene not presenting. verified collision function called using nslog.

    // game on function func gameover(){     // presenting game on scene     let transition = sktransition.fadewithduration(1.5)     self.view?.presentscene(gameoverscene(), transition: transition) } 

which called in function collision as

func ballcollidewithwall(wall: skspritenode, ball: skspritenode) {     gameover() } 

you presenting scene in wrong way. should change code like

let scene = gameoverscene(size: self.view!.bounds.size) self.view!.presentscene(scene, transition: transition) 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -