Our space shooter game is starting to look like a real game. We have enemies spawning, player is able to shot the enemies and destroy them, enemies can damage/destroy the player by running into them and the newest addition is a power up the player can collect to increase its fire power(the triple shot).
I will go through the process to setting up the triple shot power up
- Drag the sprite into the screen view
- Rename to triple shot powerup and change size
- Add the following components: Rigidbody, collider and a script
- The last thing to do is drag the triple shot power from the scene view to the prefabs folder
Now that we have the power up created and saved as a prefab, it’s time to setup the scripts.
First script will be the power up script, this will control the behavior of the power up. This is includes moving the power up down the screen and detecting if the player collects it.
Next we will update the spwan manager script to spawn the triple shot power up. We will spawn at the same position as the enemies but at a rate between 3 seconds and 7 seconds.
Now that the power up has its behavior and is being spawned, we need to update the player to set the triple shot active when collected. Also we will add a cooldown of 5 seconds to the triple shot
Even though the game is starting to feel like a real game, there is a lot more I will be adding. Such as more power ups, more enemy movements, a UI that will display player lives, score, ammo count. Continue to follow along to see the progression of my Space Shooter Project.