Chapter 2. Sprites, Camera, Action!

We will start our first game by learning how to draw shapes and textures on the screen. SpriteKit makes drawing simple by doing a lot of the hard work and exposing simple classes we can use for rendering. We are free to focus on building great gameplay experiences while SpriteKit performs the mechanical work of the game loop.

To draw an item on the screen, we need to create a new instance of a SpriteKit node. These nodes are simple; we attach a child node to our scene, or to existing nodes, for each item we want to draw. Sprites, particle emitters, and text labels are all considered nodes in SpriteKit.

Note

The game loop is a common game design pattern used to constantly update the game many times per second and ...

Get Swift Game Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.