Day 29 on my Journey of becoming a Gaming Software Engineer:
Today was a complete loop.
I coded something and it worked. Then, I added more functionality and my code didn’t work. It was really a back-and-forth kind of day.
Through all of it, there was a great Silver Lining.
I learned what a Loop was in the best way. By failing in every way a Loop was NOT. Nice.
My biggest conundrum was that I was attempting to put a number of IF Statements into a Loop, but you really have to wrap your head around the sequence of events. Especially, if you have a false-bool with True actions. Let me explain. I want the Player of my game to see a checkbox like “Stop Spawning Enemy Waves” in the Unity editor but what throws me for a curve ball is the bi-angular way of looking at it in code. It will show up in Unity as a Bool. But in code, it will show up as a False Bool, meaning it will look like this for example:
bool _stopSpawningEnemyWaves = false;
Which actually means True. And then, to throw you another curveball, in the actual Function you’re calling it in on your line of code which will cause Enemy Waves to Stop Spawning, you’d add something like this:
public void (_stopSpawningEnemyWaves == true)
LOL! If I lost you already, now you can understand how I felt.
With that being said, add in the fact that you want things called Once and other things to continue to Loop and you end up in a cluster?#<% and that’s because (get ready to be confused again..):
An IF Statement causes the code inside the IF block to execute one time IF the condition is True.
A While Loop causes the code inside the While block to execute over and over and over UNTIL the condition is NOT True.
Woah! Ok, so let me get my bearings together. I’ve totally lost them along the way lol. Nah, nah, nah.. but this is the type of bi-angularity you must master when coding. And I have the deepest respect for coders who do so.
So, getting back to today’s task that I’ve been working on for nearly a straight 14 hours and been just dumbfounded.. I’ll just say that it’s now 11:53pm and since it’s almost midnight, I’m going to call it a night. My brain is blown. I know it got this. I just need a clear head again. I’ll try again in the morning.
Till my next post.. Take Care and Aloha Forward,