xcode - Changing default SKScene -


i have class called introlayer i'm trying load inital scene when game launched. after changing gamescene introscene described in these simple steps, introscene isn't being loaded. set breakpoints on if let scene see skips on it, , set breakpoints in actual introscene verify didmovetoview not being called. ideas?

i changed let scene gamescene introscene in gameviewcontroller so:

import uikit import spritekit  class gameviewcontroller: uiviewcontroller {      override func viewdidload() {         super.viewdidload()          if let scene = introscene(filenamed:"introscene") {             // configure view.             let skview = self.view as! skview             skview.showsfps = true             skview.showsnodecount = true              /* sprite kit applies additional optimizations improve rendering performance */             skview.ignoressiblingorder = true              /* set scale mode scale fit window */             scene.scalemode = .aspectfill              skview.presentscene(scene)         }     }      override func shouldautorotate() -> bool {         return true     }      override func supportedinterfaceorientations() -> uiinterfaceorientationmask {         if uidevice.currentdevice().userinterfaceidiom == .phone {             return .allbutupsidedown         } else {             return .all         }     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // release cached data, images, etc aren't in use.     }      override func prefersstatusbarhidden() -> bool {         return true     } } 

then renamed gamescene.swift introscene.swift , changed class this:

import spritekit  class introscene: skscene {     override func didmovetoview(view: skview) {          backgroundcolor = uicolor.blackcolor()           let fadein:skaction = skaction.fadeinwithduration(1.0)         let fadeout:skaction = skaction.fadeoutwithduration(1.0)             let inspiredtext = sklabelnode(fontnamed: "dead kansas")         inspiredtext.alpha = 0.0         inspiredtext.text = "inspired by"         inspiredtext.position = cgpoint(x:cgrectgetmidx(self.frame), y:cgrectgetmidy(self.frame))         addchild(inspiredtext)            inspiredtext.runaction(fadein)      }      override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) {        /* called when touch begins */          touch in touches { //            let location = touch.locationinnode(self)           }     }  } 

however when launch app, doesn't appear introscene called when set breakpoints, , i'm getting screen gray background.

you need rename gamescene.sks introscene.sks

the sks file archived file scene data, if open up, notice can change lot of things scene, , add nodes , sprites directly it. when call if let scene = introscene(filenamed:"introscene") { unarchiving sks file loaded scene, anytime want create new scene, remember need file.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -