“trible shot” logic

Andrew Lengen
2 min readJun 1, 2021

--

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!

--

--

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!