O'Reilly logo

Getting Started with SpriteKit by Jorge Jordán

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Geometrical primitives

When developing games, you will usually work with high-level elements, such as sprites, labels, particle systems, or physical bodies. But sometimes you will need to create simple shapes, such as circles, lines, rectangles. For example, you may need to do so to create a prototype for your next game.

SpriteKit provides us with a subclass of SKNode named SKShapeNode, which doesn't have much potential. This class allows us to create rectangles (init(rect:), init(rectOfSize:), init(rect:cornerRadius:), and init(rectOfSize:cornerRadius:)), ellipses (init(ellipseOfSize:) and init(ellipseInRect)), circles (init(circleOfRadius:)), and other types of shape by providing its vertices (init(points:count:)) or path (init(path:centered:) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required