This is a pretty simple fix in itself!

If you have noticed the Hierarchy gets bloated with the Triple Shot because it is not being destroyed as soon as it goes off screen like the laser, why? Parents.

If you remember earlier we created a container for the Triple_Shot, which is the Parent. It won’t go without a fight! Here is our weapon of choice!

I realized I forgot to add in the means to have it deactivate after a certain amount of time — we need IEnumerators!

With our IEnumerator, we’re going to allow triple shot to be enabled for 5 seconds, then disable triple shot!

With this in place…

We now need to make a call to it from our function, _tripleshotCheck()!

It’s time to create our power-up! We’ve simulated triple shot through our Inspector through a toggle and now we need to make the actual pick-up!

Drag a sprite of our choosing to the Hierarchy, renaming that sprite to “Triple_Shot_Powerup”, resizing the sprite, giving it a 2D collider and checking the “Is Trigger” box (because this will be an “OnTriggerEnter2D()” event!), and lastly adding a “Rigidbody 2D” with “Gravity Scale” set to zero!

Let’s also get our “Powerup” script made in our Scripts folder then drag that into our Triple_Shot_Powerup!

With all that we can start writing our script for our Power-up!

Andrew Lengen

Andrew Lengen

If ambition and practicality amalgamated, it would be me! I am here to climb the mountains of my ambition and catalog my journey so that someone can be changed!