“trible shot” logic

Since our prefab is set-up, we can start working on the power-up. We’re essentially collecting a sprite that tells the Player, “Yo, you can use this” and enable the Player to “Triple_Shot”.

Planning this out we need to check if Triple Shot is enabled, then fire the Triple Shot — so let’s first create our new GameObject to store our “Triple_Shot” prefab and create our bool!

For testing purposes since we don’t actually have the power-up built we will [SerializeField] so that we can toggle Triple Shot. With that out of the way, we can work on the logic of firing this triple shot!

An issue we’re also going to run into is that our Triple Shot prefab was not properly aligned to our ship when it shoots, here is a wonderful tutorial on how to fix that up: essentially we didn’t adjust the children while the parent was at position 0,0,0 position so it is offset!

So this is our new code! Undecided on reducing ammo by 3 but whatever for now!

And this is our result!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
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!