Add Nodes Using the Object Library

Apple Game Frameworks and Technologies — by Tammy Coron (78 / 193)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Add the Assets | TOC | Configure the View and Loa d the Scene 👉

In Add the Background, you added a background image to the game scene by creating a new background sprite node. You then added that node as a child node of the game scene; you did all of that in code.

However, this time around, you’ll create and add a background node to the node tree using the Object Library, and you’ll set its options using the Attributes Inspector. But first, it’s time for a quick tour.

Touring the Scene Editor

From within the Project Navigator, select the GameScene.sks file. Files with the sks file extension are known as SpriteKit scene files. This particular scene file is what gets loaded from the GameViewController.swift file. You’ll learn more about how that works in Configure the View and Load the Scene.

When you select the GameScene.sks file, it opens in the Scene Editor and looks something like the image.

images/BuildingScenesWithTheSceneEditor/scene-editor-interface-overview-callouts.png

To see the entire scene, you may need to zoom out depending on the size of your monitor. You can control the zoom level in a few ways: from Xcode’s App menu, select Editor ▶ Zoom In or Editor ▶ Zoom Out; you…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.