All you need to know about nodes
We have discussed many things about nodes so far. Almost everything you are making in a game with Sprite Kit is a node. Scenes that we are presenting to view are instances of the SKScene
class, which is a subclass of the SKEffectNode
class, which is itself a subclass of the SKNode
class. Indirectly, SKScene
is a subclass of the SKNode
class.
As a game follows the node tree formation, a scene acts like a root node and the other nodes are used as its children. It should be remembered that although SKNode
is a base class for the node you see in a scene, it itself does not draw anything. It only provides some basic features to its subclass nodes. All the visual content we see in a Sprite Kit made game, is drawn by using the appropriate SKNode
subclasses.
Following are some subclasses of SKNode
classes, which are used for different behaviors in a Sprite Kit-based game:
SKSpriteNode
: This class is used to instantiate a texture sprite in the game; this is a familiar...