Adding the Power-up Star

Many of my favorite games grant temporary invulnerability when the player picks up a Star. We will add a hyperactive Power-up Star to our game. Meet our Star:

Adding the Power-up Star

Adding the Star class

Now that the art is in place, you can create a new Swift file named Star.swift in your project; we will continue to organize classes into distinct files. The Star class will be similar to the bee class we created earlier. It will inherit from SKSpriteNode and adhere to our GameSprite protocol. The Star will add a lot of power to the player, so we will also give it a special zany animation based on SKAction to make it stand out.

To create the Star ...

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.