Day 11 of my Developer Journey: Triple Shot Power up set up

Marek Ondrej Valco
2 min readJul 13, 2021

Time to set up our first power up. Firstly, we shall copy and adjust 3 of our laser prefabs to be around our spaceship, to our desired locations.

Laser setup

We shall put all laser under 1 parent object, give them all their colliders, and fix the z placement. We need to make sure that all objects have a 0 on their z axis, or the laser will be off center.

Time for code. First, we need to add a check if the powerup is active. This means we need a bool variable and a variable for the triple shot prefab.

Our bool variable to check for activeness and the new laser variable

Next, we will edit our fire method from before with an if else check. This will decide which variable we should instantiate. Since our bool is set to false, we will continue firing our standard laser until this statement changes to true, then it will spawn our triple shot only.

Our if else controller

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response