Book Image

iOS Game Programming Cookbook

Book Image

iOS Game Programming Cookbook

Overview of this book

Table of Contents (19 chapters)
iOS Game Programming Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding scenes, nodes, and sprites


The whole game is organized into scenes, which have the content represented by SKScene 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 objects are responder objects that respond to the delegates of UIResponder. This is used to detect input touches to the scene for moving objects...