There are some new enemy types to introduce, and one of them is a more aggressive enemy that rams the player when they’re in range.
After some edits to the Enemy script to organize the new enemies with a switch instead, I add the following code for this particular enemy.
For this challenge, I’m to create a pickup that’s actually a debuff of some kind. I’ve decided that this debuff will jam the trigger, making the player unable to fire for the duration of it.
The steps to create the prefab, its spawning code, and duration code is the same as the pickups and collectibles done before, so below is the new, relevant information for how it works.
First, the UI Manager will change what the ammo counter text when the debuff is active, to say “JAMMED” instead.
Aside from the Triple Shot powerup, the Player will be given another alternate fire mode powerup, a 360 multi shot.
First I set up the Powerup object the same way as before.
Next I create a new laser type prefab by arranging eight lasers around the player. This will be what the Player instantiates.
Then I add this Powerup to the Spawn Manager, while adding new code in the Powerup script to activate this 360 Laser on the Player when collected.
Lastly update the Player script to toggle this fire mode on when collected and start the coroutine timer to turn it off after five seconds.
The Player needs an indicator too obvious to miss that they’ve taken damage. It might be too late if all I rely on is the visual fires on the sprite or the lives counter. Nothing is more obvious than having the entire screen shake violently.
To do so we will need to deal with the camera, inside the UI Manager.