The Big Crash

Joe Kuka
4 min readDec 18, 2020

I have to be honest, its been a while since I have sen one of these. It has many names, most commonly referd to as the “spinning wheel of death” which is ironic because the programmers tried to make it as happy as possible and I mean whats more happy than a spinning rainbow “pinwheel”. Most kids have probably never even seen this symbol, or its counterpart for PC. What does it mean? Well it means that your computer is thinking and much like we program in a load screen in a video game our computer does the same. It uses an coroutine same as the ones we have been learning to program. saying that while some variable is true or at a certain point then show the load pinwheel, and then stop once the program or thing is loaded. With modern technology and fast computers this symbol has become a little more on the less common side, but you will still see it from time to time when you are telling your computer to do too many things. Yesterday I managed to not only see this symbol but crash my computer twice while building my game lol.

I started my day off working on my shields and the task was to give the shields lives, or 3 hits to be exact. To do this first we need to look at what the shields are, well they are a game object, and that game object starts in the “off” position attached to the “player”. All of those things are important because now we know that we need to turn the shields “on” somehow and we can find them on the player script. There is no need to write a separate script because the player has all that we need. The good news is we already had a method that turned our shields “on” and “off”, now we just needed to add lives and damage.

Here is what I ended up with, I did something similar to our lives, and the way damage worked by creating another method public void ShieldDamage() and then wrote a “if” statement. I chose to go with the flicker routing that we used for the game over, but at different speeds. To do that I created 2 separate coroutines and then implemented them into our ShieldDamage(). I then created an “if” statement to say that when shield lives is less than 1 to turn off the shields. After all we do not want to destroy the game object, but simply turn it off. We then call this method in our player.Damage() so anytime we need to call damage we just call that method.

And then came the challenge that I thought, “Piece of Cake” , “No Problem”. The challenge was to create a power up that reloads our player with ammo once we are out. This required a bit of research as you have to add a sprite to your game. But once I figured that out we were off to the races, and now watch out because I’m going to put all kinds of crazy sprites in there! Anyways I had my game object that I wanted to spawn and I had written what I thought was the right kind of code. I figured this object should be a part of the spawn manager since that is where game object spawn from currently, but I had a lot of trouble getting the game object to spawn when my ammo ran out. Finally I thought I had it, and started my game up. Shots were fired and the ammo counter was running down….5,4,3,2,1,0………! There it was as beautiful as it is deadly, the “Spinning Rainbow pinwheel of Death!”. Okay no big deal I can fix this, 2 hours later however, and several swear words, hard resets, and a complete rewriting of a few scripts the problem was still not fixed. I stepped away for a few minutes to reset my brain and finally at least got my computer to not crash. What I had done was to create a loop of code that ran forever and nothing was telling it to stop. Now that I have fixed that today I will still be working on making sure my ammo refill only spawns once we are out of ammo, and it only spawns 1 time. Happy Aloha Friday everyone!

--

--

Joe Kuka

I am a self taught game developer and love pushing myself to learn new things.