Game Development Reference
In-Depth Information
Understanding scenes, nodes, and sprites
The whole game is organized into scenes, which have the content represented by SKS-
cene objects.
A scene is an entity that holds all the content, that is, nodes and sprites that are to be
rendered. It also implements the setup or anatomy of content processing and updating each
frame.
The SKScene class is a subclass of SKNode, which is the fundamental building block of
SpriteKit. Every entity in SpriteKit is inherited or derived from the node (SKNode). So
SKScene is the root node for other nodes, which are used to populate the content over a
scene.
Similar to UIKit, each node's position is specified according to the coordinate system of its
parent. A node also has the basic properties that a content item or entity should have such
as moving, rotating, scaling, fading out, and many more. And most important, all node ob-
jects are responder objects that respond to the delegates of UIResponder. This is used to de-
tect input touches to the scene for moving objects and some other stuff depending on one's
gameplay.
Now, sprites are represented by SKSpriteNode objects. They are nodes with images on
them. We can specify content or a textured image to them as we have to make some player
or enemies in a game. SKSpriteNode is also inherited from SKNode. Additionally, its con-
tent can be changed and animated. The sprites are created and added on scenes with some
actions to make the game scene more alive.
Search WWH ::




Custom Search