Game Development Reference
In-Depth Information
Figure 1-8 . Adding Image Assets
Next, using Finder, browse to the Images folder in the previously downloaded zip file and
finally select the three folders inside the Images directory and drag them onto the xcassets
palette directly below the SpaceShip asset. When the files have been added, your xcassets
palette will look like Figure 1-9 .
Figure 1-9 . The Added Image Assets
Now that you have all of the images added to your project, let's put some of them to good
use. Go back to GameScene.swift and add the following two lines to the beginning of
the GameScene class:
let backgroundNode : SKSpriteNode?
var playerNode : SKSpriteNode?
Here you are adding two optionals, backgroundNode and playerNode , both of
which are SKSpriteNode s. An SKSpriteNode is a descendent of an SKNode ,
which is the primary building block of almost all Sprite Kit content. SKNode itself does
not draw any visual elements, but all visual elements in Sprite Kit based applications are
drawn using SKNode subclasses. Table 1-2 defines the main descendants of SKNode that
render visual elements.
Search WWH ::




Custom Search