in game right i've got gamescene.swift , gameoverscene.swift. when game loads, gamescene.swift shows , game plays great. however, i'm done gameplay, how can add start screen displays when app opens?
to create scene runs when app first opens, have make adjustments game's view controller. first change
let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! gamescene to
let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! scenename and line in didmovetoview
if let scene = gamescene.unarchivefromfile("gamescene") as? gamescene { to
if let scene = gamescene.unarchivefromfile("gamescene") as? scenename { this change opening scene gamescene scenename, or whatever called scene. also, must declare scene this: class scenename:skscene {...}. can create new .swift file (cmd + n) score class in easy file management or can put in gamescene file. happy coding.
Comments
Post a Comment