Chapter 3. Sprites
In the previous chapter, we set up our first scene, learned about the rendering of nodes in a scene, added multiple scenes in a project, and learned about doing transitions from one scene to another.
In this chapter, we will learn about sprites. A sprite is a two-dimensional image, integrated into scene. A collection of sprites is called sprite sheet. Here we will learn about how to add sprites in a game, positioning a sprite, texture atlases, and how to transform a sprite in our game.
In Sprite Kit, a game is based on the node tree hierarchy. Scene acts as a root node and other nodes added to it are child nodes. Once all nodes are rendered into scene, we get the view. Sprites are also added to a game as a node; Sprite Kit provide us SKSpriteNode
class for this purpose. In the previous chapter, we added background sprite and play button sprite by making the SKSpriteNode
reference and adding it to the respective scenes. Now we will discover more about what Sprite...