Creating Health Powerup

Objective: Create a powerup that when collected will restore health to the Player.

I will be adding to the modular powerup system I created in This article and I will be creating a powerup the same way I created my other powerups in previous articles.

The first thing we need to do is create and animate the powerup:

We will also need to add the powerup as a random powerup that can spawn to our Spawn_Manager script and add the powerup to the powerup’s array:

Once you add the powerup to the array and have it spawning in we need to create the behavior for giving the Player back one health:

This Method will give the Player back one health if the player is not full health, Update the UI for how many lives the Player has, and turn off the damaged wing visual for the Player’s engines.

The last thing to do is call the newly created method from the Powerup script:

Learning to become a unity game developer