“trible shot” power-up logic

Andrew Lengen
2 min readJun 9, 2021

So our logic is going to be almost identical to our Enemy!

We want the power-up to move down the board, but instead of respawning at the top in a random place we want to destroy it. We also want it, when it collides with the Player, to be absorbed and enable Triple Shot!

In the Player script, we want to first create a function that can be accessible to the Powerup script that allows us to enable Triple Shot:

With that we can move into our Powerup script and begin the logic for the power-up. For movement, we want it to translate downwards, and once it hits the bottom of the screen we want it to be destroyed!

We take that newly created function and move it into Update()

We now need to create a collision trigger that activates when the Player collides with the power-up, enables triple shot and destroys itself:

With that all in we can see below…
That our triple shot powerup moves down, and once collected enables triple shot and removes itself!

--

--

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!