Strap on your hard hat, we are going to be writing a lot of code in this chapter. Stick with it! The results are well worth the effort. Meet the new cast of characters we will be introducing in this chapter:
Many of my favorite games grant temporary invulnerability when the player picks up a star. We will add a hyperactive star power-up to our game. Meet our star:
You can find the art assets for power-up stars and coins inside the goods.atlas
texture atlas in the Coins
and Powerups
folder of the assets bundle. Add the goods.atlas
texture atlas to your project now.
Once 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...