60 days to become a game developer. Day 45.

Mar McRae
4 min readDec 4, 2020

--

Here is a recap of yesterday, Day 45 of my 60 day challenge to become a Unity Game Developer!

Checking In

I only have 15 more days left of this challenge!!

I have to admit being on this team definitely does make me feel like I’m getting closer to my goal of being a game developer. I’ve got SO MUCH to learn and SO MANY things that I could be better at but still it’s a really wonderful feeling to be able to look at a C# script and generally know what the intended behavior is (usually) or to be able to read an example on the Unity docs without being on the brink of a nervous breakdown (…well again…usualllllly). How far I’ve come; but it ain’t over yet.

Getting closer to the end is definitely bitter sweet as days like today are lovely but I also realize that this isn’t exactly like the “real world”. Yes, we are creating a game that’ll be published. Yes, the general workflow might be the same…or at least how I imagine it to be, standups in the morning, check ins in the afternoon, merge, push, pull, all that, but the key difference is everyone in this internship seems to truly want to be here and with that, an enthusiasm and excitement to do the work. I especially see this on my team. You can tell how pumped my teammates are to show what they’ve created, how they’ve implemented things, and the genuine sound of triumph when we all work to figure out a bug that’s been warping our minds... I get it, I feel the same way. To be in that energy is a gift, and it’s rare, so my new secondary goal from now until the end is to remember to truly appreciate every day that I have here.

Project

Check it out!

Nope, my fingers are not that fast! The weapon now instantiates automatically whenever a target is within its line of sight. See how below :-).

Some stuff I worked on:

  • I took a lot of the day to clean up what I created yesterday. There were some things that I moved onto their own script, for example, originally I had the weapon fire behavior on the same script as the player damage method when it makes more sense for them to be separate. Working on this team has made me really understand the importance of good code organization and design.
  • I also spent some time trying to trim down my weapon firing behavior. I realized after my last post that I could greatly shorten it and get similar behavior just by using the integer that I created to reference my switch case to also reference my weapon index in the weapon game object array since they will pretty much always be at the same value.
  • After talking it over with my teammate whom I’ve been working on this with, we decided that it’s probably best to keep the original as his weapons will not always instantiate the same way. Love teamwork! Still I was happy to have recognized that my code could be trimmed down as this could’ve been a much lighter implementation had the weapons all had the same instantiation behavior. After cleaning it up a bit from my last post, here is what I landed on:
If you read my post from earlier, you may notice that now the only thing happening from within the case in setting the value of weaponCurrentlyOn. I also added in a powerup tag, so that only the powerups will trigger this behavior. There were no changes to the fire shot method. If you want to check it out take a look at my Day 44 blog.
  • I also created behavior that automatically shoots at the enemy if its within “sight” of the player by using Raycast. Raycast is a boolean and this works by casting an invisible ray between our player and colliders within the scene based on the direction set. It then returns a value of true or false. All I needed to do then was create an if statement to call the FireShot() when it returned a value of true. That is what's creating the firing behavior in the gif above. Here’s the code:
The fire rate sets the speed. The lower the number the faster the speed as this means less time between instantiations. The update() is called ~60fps, so if there was nothing there to slow it down, the weapon would firing like crazy.

Challenges:

  • Today I bring you an anti challenge, dare I say… a win. For the first time, in a long time I used git and I had zero issues! No unexpected red, no white, no untracked changes. Zip, zero, zilch. I was very surprised at this because as sincerely embarrassing as it is, with unity I’ve had a horrendous git track record. Many of hours have been sacrificed to the git gods both in lost work and help to try and avoid losing it. To have done a pull request, created multiple branches, pushed, pulled, etc. and all be well, all be clean means it is a happy happy day for me!

Tomorrow we should be finalizing everything for the weapon and maybe starting a new feature. As always, should be good.

Later.

--

--

No responses yet