Day 7 — Nearly a Game!

Benjamin Lihn
3 min readNov 25, 2020

Today was not without a couple challenges, but I’m proud of myself for getting past two time-stealing hurdles. I learned a lot today: new logic material and supporting code, as well as how to debug issues through research (and a little help from Dan Schatzeder).

I completed the Special Effects (VFX) section of the course. With this, the user now must destroy a rotating asteroid with the player’s laser to start the game. I was able to complete the challenge to delay the spawn sequence at the beginning of the game as well. I’ve added a sprite with animation for “thrusters” on the player, as well as animations for “damage” to the player when game lives are lost. Also, the destruction animation for enemies has been shortened. The game is really coming together nicely.

Collided with two enemies!

I had a challenge with the asteroid script in which I was getting a null exception error in Unity’s console after destroying the asteroid to start the game. I confirmed the proper assignments were made in Unity, and the script looked okay. I even wrote a double-blind null check to ensure the asteroid script was getting the component from the spawn manager, as it needed to. Time and time again, I received the “spawn manager is fine” debug log — meaning it should have worked. However, as I now know, one equal sign with a variable (even INSIDE of if statement logic) is setting the variable, whereas two equal signs compares values. Meaning…

if (_spawnManager = null) is NOT the same as if(_spawnManager == null). One equal sign sets the variable to null. The null check needs two equal signs. I knew that, but now I definitely won’t forget it. Now solved, all good, everything else is working as planned.

Once obtaining this solution, I moved on to the post processing section of the section of the course. In this, I learned how to install a post processing package and apply some post processing effects on a post processing volume. For some reason, the post processing effects do not seem to be making any changes on my scene view in Unity, but I’ve decided to view these changes through the game view and not lose time on trying to diagnose this right now.

I really liked the ACES tone mapping — to me, it looks like a movie. I chose cooler colors since they felt more fitting to an outer space scene, and the contrast with fiery explosions and flashing animations is very visually appealing. I also added background music to the game — the bass is thumping! Love it!

Next up are additional post processing steps, and circling back to a few other implementations I’d like to add to make my game more unique. I’m thinking of bonus lives/health powerups, alternating between which side of the player takes damage first, and some general tweaks.

--

--

Benjamin Lihn

Coding my future as a software developer; // if (attitude > 0) {progress ++;}