From Photographer to Video Game Creator — Day 5
One week down and with the amount of information thrown at me this week it feels like I’ve been coding for months! Today was all about smoothing out my Triple Shot powerup and setting the spawn rates.
Yesterday, I coded the function for what the Triple Shot does and made sure I could toggle it on and off. Now, I had to create a Triple Shot object that would fall down the player screen. This was very similar to creating enemies. The powerup needed to fall at random intervals and have a trigger collision that would make it disappear.

More practice with script communication was definitely nice and I feel as though I’m starting to get a better understanding of it… hopefully! I then set up an IEnumerator on my Spawn Manager script:

This one was very similar to my Enemy spawn routine except for this one I set the Triple Shot to spawn at a random time between 3 and 8 seconds using the “Random.Range” code.
I then set up a public void along with another IEnumerator on my Player script. A public void allows other scripts to access it and make changes. In this case, once the Player has collected the Triple Shot powerup the boolean originally set to “false” is now changed to “true”. This will start my Triple Shot Power Down Coroutine. The Triple Shot will be active for 5 seconds and then set back to “false” or not active.

I know, kind of code heavy start to the day, BUT it did have some cool results! My Triple Shot power up now falls down the screen at random intervals AND can be collected by my Player.

The nerve racking part was actually collecting it with my Player. May have crossed my fingers and hoped for the best before colliding into the powerup… but it worked! My player now shoots three lasers AND the Triple Shot powerup is destroyed after the collision!

I was feeling good at this point, so I continued on to a little introduction to animation. By opening up our Triple Shot Powerup prefab and dragging all of our sprites onto it, I was able to easily create a simple text animation. As the object falls through the screen, the text now quickly changes colors! I made sure to override my prefab before deleting it so that all changes would be applied.

I also joined the afternoon workshop which went into further detail about animations. It was exciting to see more of the processes when it comes to animation and it was even a little intimidating. The possibilities are endless!
Stoked for a mental break this weekend and I’m ready to add more powerups next week!
Peace!
-Myles M.