Adding the NODE MENU button
We have created a node menu scene that displays examples of the nodes in a game. We are now going to add a button on the main menu, which will allow users to access the node menu scene:
Firstly, we have to create an instance of
NodeMenuScene
in the beginning with the following line of code:var nodeMenuSceneInstance : NodeMenuScene?
Now, we have to set attributes of the NODE MENU button label, as we did for the Level: label earlier. For this, add the following code in the
addNodeMenuSceneBtn()
method and call it from thedidMoveToView()
method also:func addNodeMenuSceneBtn() { var backbutton = SKLabelNode(fontNamed: "Chalkduster") backbutton.fontColor = UIColor.cyanColor() backbutton.name = "NODEMENU" backbutton.text = "NODE MENU" backbutton.position = CGPointMake(CGRectGetMaxX(self.frame) - backbutton.frame.width/2 , CGRectGetMaxY(self.frame) - backbutton.frame.width/8) backbutton.zPosition = 3 self.addChild(backbutton...