From Photographer to Video Game Creator — Day 12

Myles Marion
2 min readDec 16, 2020

--

Today was my first day on my own! No lessons to follow and no solutions to read through. I was finally taking off the training wheels!

The first task was seemed pretty simple. I needed to give my Player the ability to boost when the ‘shift’ key was pressed and then return to normal speed when released. I jumped into the Player script and placed a “GetKey” command within my void update. I assigned the left shift key to initialize the boost sequence.

The boost script looks extremely similar to the regular Player movement script. The only exception is that the speed is now multiplied by 2.

The next task took A LOT more time. I noticed an issue when the Player was collecting powerups. Everything seemed work fine. The powerup could be collected, the coroutine would begin for the cool down timers, and then the powerup would turn off. Perfect, right? Nope…

When the Player would collect a second powerup of the same type, before the first powerup was deactivated, the timer for the powerup would not restart. I needed to restart my coroutine for the specific powerup to restart the cool down timer. The solution was to use a “StopCoroutine” and “StartCoroutine” command while initializing the IEnumerator with a “string”. The string is important because without it, the coroutine just pauses and then resumes.

I am in the process of following this same idea for my other powerups. Tomorrow I am going to push my shield powerup a little further by attempting to give it 3 hits or lives before the object is destroyed. Maybe I will be able to depict this by changing the color of the shield as it weakens.

Later!

-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