Welcome to the fourth entry of my game development journey.
Where I do nothing but complain and maybe learn about how to use the Unity Engine to make a game. This time around I think I may have done the most and also the least amount of work toward my progress. How is that possible, you ask? Easy when you've been lazy since the eighth grade, but can also easily get motivated and spend hours on one little thing.
Anyway, last time I complained that one video in the tutorial was over 40 minutes. Welp, after that last blog went up, I conquered it. And to be honest, there was a lot to do and follow along with. Lots of logic and processes that would fly over my head. All that work in order to have the game register the shots coming out of your blaster and hitting the enemy. Jeez if it takes that much thinking in order to shoot a guy, then I'll just stick with a simple math game, ha.
Computers take things literally.
While essentially this is all I did during the video, it takes lots of working pieces to put together in order for everything to work correctly. Any type of programming and coding is essentially a series of statements that you have to make sure follow proper order and make sense logically. So even if you have a nice statement on its own, if it doesn't fit within the overall process and logic, it can lead to errors or unintended consequences. The best real-world example is creating a recipe. You wouldn't have the "preheat the oven" step be after making the cookies, that would be first! On a more erroneous scale, you wouldn't have "put cookies in oven" as the first step. That doesn't fly in programming - mainly because they're words, but also because it doesn't make sense.
For me, though, my biggest problem with any programming challenge was how to begin. I would always know what had to happen and could follow the logic, but actually implementing it was over my head. But luckily the internet is there to help. I mean even my workplace supervisors and colleague's say that Google is your friend, you just gotta know where to look. Thank you, Internet.
After this hellish but necessary 40 minute video, I kept the high going and finished the rest of the videos in the tutorial later that week. So let's see what else was left.
Oh look, a scoring system! I won't get into the details, but when you are actually doing the scripting and coding for this, it's actually really easy. Every enemy has a certain amount of health, which my blaster chips away at. Big guys take more hits, little guys take less. The same applies to the score. Big guys give you more points than the little guys. The score is essentially overlayed on top of the scene - the level - and changes in real-time. It's actually connected to the same display that my HP bar is on. This part of the tutorial felt very much like photoshop with regards to this because each object was essentially a layer you had to order to have the right icons and screens show up during certain events.
Although the scoring system was easy to code, it wouldn't have happened had I not done that 40 minute video in which my hits registered. If the game doesn't know that my shots are landing then how would my score add up. Again, all the logic has to make sense, along with the order of the processes, in order to work.
The tutorial at this point was nearing its end. I had to add different enemies and make them spawn at different intervals. There were issues here because even though I got the enemies to spawn, they got stuck. Or another issue: they were animated, but only stayed in place. Because this tutorial was using a different Unity Engine version, some settings or resources were changed. I don't think I had to change any code either, it was simply a matter of reorganizing the scripts to the objects that they were connected and assigned to. Literally a cut and paste job.
Fortunately for me, others had this issue and were able to supply an answer. It can not be overstated how much of a tool the internet is. And the funny thing about my issues were that every answer I found was on the video I had trouble with. I didn't have to look at the Unity website or forums - it was right there in a YouTube comment with thousands of likes. I guess I wasn't alone. After that nice conveniently placed answer to my problems, it was smooth sailing.
I said earlier the scoring system display reminded me of the layers in photoshop - or GIMP, if you're into that kinky stuff. Essentially each object had to be positioned with respect to what the player would view. The Game Over screen seen below, had to actually be positioned second to last, while the score text was last. Meanwhile the HealthUI group of objects had to be on top. What is happening is that the ScoreText and GameOverText were in front of the others, so the HealthUI was actually behind all the other objects.
The reason why you don't see the GameOverText screen is because its transparency was set to 0, so it was basically invisible to the player. When the player would die, this event would trigger the GameOver screen to turn visible and turn a solid blue. Because it's ahead of the other objects in the UI, it blocks everything, but the score, since that is in the front. The result is what you see below.
And that's pretty much it! All that was left was to compile the game into a neat little executable demo. Which literally takes 5 seconds to start and the rest is done by Unity. I clicked on the icon and was instantly playing a game I had pieced together and scripted/coded. Neat!
I was talking to a colleague who has way more experience in actually developing a game from the ground up and he recommended a particular Unity course in Udemy. I held off because I wasn't sure if I wanted keep doing more tutorials or if I should just start toying with my game idea and go from there. As luck would have it, the course that would normally cost $190 (I'm sure they're never that much even if they say that) was on sale for $13.99. The course has over 4 stars and was labelled as being the most popualr course. So yeah I bought it.
But that was 3 weeks ago. After I finished this tutorial and after buying the course a few days later, I haven't touched Unity since. I did start the new course, but left off at the Project start of the series. I burn out real easy. But after this 3 week sabbatical, I think I finally am ready to start again.
I mean I have to if I'm going to make another blog post, after all.