Add Labels to Show Current Level and Score
If you’re familiar with UIKit, you know that you can add labels to your views using the UILabel class. In SpriteKit, however, rather than using the UILabel class, you use the SKLabelNode class.
Like other nodes in SpriteKit, the SKLabelNode class is a subclass of SKNode. That means all of the properties and functionality of the SKNode class—like position, scale, and rotation—are also available within the SKLabelNode class. However, label nodes in SpriteKit are not as intuitive as some other nodes, like sprite nodes, for example. But don’t worry, this chapter will help to unravel the mystery.
Your first stop in learning about labels in SpriteKit is how to add custom fonts to your project.
Adding Custom ...
Get Apple Game Frameworks and Technologies 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.