Week 6 of the GameDevHQ 8 week intensive
Its week 6 of the intensive and we are in the home stretch now. Looking back at last weeks post it seems my math was a bit off lol as today officially marks day 50 of my 100 day coding challenge as well. I have learned a huge amount in the last few weeks, and challenged myself in this new world of coding more than I thought I could. So today I wanted to review a few of the things I learned last week that I thought were cool, and show you how the game is coming along.
Week 5 focused on putting together most of our UI (User Interface). This is all of the parts of a game the user or payer is able to interact with. In our tower defense game that is the ability to place a gun turret, upgrade a gun turret, play, pause, fast forward, and restart the game. The UI also controls all of the on screen elements you see such as the armory, lives counter and war funds. In order to do this we need lots of script communication from our other manager classes. They will all tell our UI when to update the life count, or to update our warfunds when we purchase a turret. I also have it set up that when our enemies make it past all of the turrets they start to take life from the player. At certain levels of life the whole UI will change colors. The UI provided for us was original a blue color, and inn order to get the white color I jumped into Photoshop and added a fill/adjustment layer and then selected the hue/saturation option. With this layer mask you are able to adjust all colors or certain colors you want in many ways.
These color changes can be very helpful to the player notifying them that maybe they should pause the game and move some turrets around to ensure no enemies get past them. All of these changes happen in real game time and the player has control over the game speed, and can even pause the game to make upgrades or place new turrets. Setting up most of our UI took some time, and lots of testing to make sure it was working the way I wanted it. I learned about button click events this week where you can create an event that happens when you click the button. This tool is very powerful as you don't even need to know how to write code to use it. Simply select the GameObject you want to access when the button is clicked, and then you can even select methods within that GameObjects script to activate.
Another really cool thing I learned this week was how to build simple shaders. I have only just scratched the surface on this one but they are very awesome toold you can use to create visual effects, and even things like health bars. Pictured below is the health bar I created for our enemies and this was done by using a quad GameObject and a shader I created to apply to it. In a nutshell shaders work on a 0 -1 scale where 0 = no color and 1 = all color. You can make all kinds of custom adjustments to them as well.
For this shader I created a color and then used several properties called nodes to get this draining health affect. All we are really doing is telling the code to go from 1 on the right to 0 on the left over a period of time or every time the enemy takes damage. As it does this the color changes and is removed.
This week is focused all on optimization and I can honestly say I have a lot to do. One of the important things I have learned is that first you make the game work, and then you optimize it. This is especially important when learning how to code because when you are optimizing you will understand it better if you already know how your game is working. I can also happily say that even though I have spent many pain staking hours being stubborn and not asking for help I still have not simply given up and copied someone else's code. I prefer the trial and error method and writing my own code. Another thing I have learned and I struggle with is, “Its okay to ask for help sometimes”. There are times when you just need a second pair of eyes to look at your code and say “ahhhh you missed this thing” or “have you tried this?”. So many times it has just been the smallest thing messing everything up. One thing I do want to look into more is camera stacking to create different views and even things like a close up zoom for when the enemies come into the game. Mahalo for reading and as always Mahalo for your support. I hope everyone makes this a great week!