swift - GameScene misses initializers -
i error "class 'gamescene' has no initializers" when try add level selection game.
i present scene in gameviewcontroller.swift this:
override func viewdidload() { super.viewdidload() if let scene = gamescene.level(1) { // configure view. let skview = self.view as! skview skview.showsfps = true skview.showsnodecount = true skview.showsphysics = true /* sprite kit applies additional optimizations improve rendering performance */ skview.ignoressiblingorder = true /* set scale mode scale fit window */ scene.scalemode = .aspectfill skview.presentscene(scene) } }
and in gamescene.swift wanted handle level selection (got ray wenderlich ios game development books)
class func level(levelnum: int) -> gamescene? { let scene = gamescene(filenamed: "level\(levelnum)")! scene.currentlevel = levelnum scene.scalemode = .aspectfill return scene }
but error mentioned , dont know how fix issue :-? there other ways make level selection? have each level 1 sks file, find handy, since enables me lay out levels visually.
any recommendations and/or help? in advance
Comments
Post a Comment