From Photographer to Video Game Creator — Day 6

Myles Marion
3 min readDec 8, 2020

--

Well, here we go, WEEK 2! I had a nice, relaxing weekend and I came into Monday ready to make some progress on my game! Last week, I left off with just finishing my Triple Shot powerup. Next on the list was to add a Speed Boost powerup along with a Shield powerup.

I started the day with a quick lesson talking about script optimization and how multiple objects, or in my case powerups, can run off of the same script. Following a similar process to building the Triple Shot powerup, I was able to successfully get my Speed Boost powerup falling through the screen and enabling a trigger collision with my Player made sure the powerup was destroyed on impact. I also made use of the Debug command to ensure that the Player object and the Speed Boost powerup were communicating with each other.

When collecting the Speed Boost powerup in game, here is the message I received which let me know everything was working properly.

After setting a speed boost multiplier and writing a cool down coroutine, I now had a functioning Speed Boost powerup that could be collected by my Player.

I continued on and created my Shield powerup which would allow the Player to take one hit from an enemy without losing a life. The Shield object was then added as a child to my Player object, which allows the script to easily access it to turn on and off the animation.

So far, today has been much needed by really drilling in script communication, which was 100% the concept I was struggling with the most. Now, I had three fully functioning powerups that could all be collected by the Player!

Now it was time to take my script optimization a step further by creating a Switch statement. A Switch statement is used in place of an If statement to help clean up your code and make it much easier to read.

A Switch statement must be coupled with a fixed list or an “Array”. Here is mine I created for my powerups:

Now, I have the ability to attach numbers to my powerups and assign them random spawns within my Spawn Manager. In Unity, my powerups now have a sweet drop down menu where these adjustments can be set.

Tomorrow, I move on to User Interface and I’m stoked to see how it starts to come together for the player!

See ya then!

-Myles M.

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

--

--

Myles Marion
Myles Marion

Written by Myles Marion

Professional photographer on a journey to create my first video game!

No responses yet

Write a response