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
Post a Comment