As mentioned in my Day 50 post, I am writing this blog a few days late. Again, in case anyone is reading these posts day by day, thanks for your patience and also thanks for reading these!
To be frank, this week flew by and most of the days sort of blended together so it’s a bit hard to remember everything that happened on Day 51. One thing that I’m pretty sure I worked on that day was fixing some bugs with the powerups.
The powerups system was one of the very first things that I created as it is a part of the weapons system. As a recap, this game works by the player’s weapon getting incrementally better with each powerup that is collected. If the player gets hit their weapons drop down to the base weapon, if the player gets hit twice, he dies. Another valuable lesson that I learned is to remember to go back and playtest the features that I created early on to ensure that they’re working as intended with the new features that others have created. I did not do this and this ended up being one of the things we needed to adjust in that debug session on Thursday night. This is however still my Wednesday post, so I’ll save what those changes were for the end of this blog.
Here’s what happened on Wednesday:
Since we already had an enemy abstract class all we had to do was add in very simple logic to create a random integer between 1 and 3 and have the enemies instantiate a power up if the number was equal to any one number 1–3 and call it in the Start().
Here’s what that looks like:
This definitely got the job done though this is another thing I’m planning to bring up in my code review. Wondering if there is a better way to do this. Also wondering as a matter of practice, is less more? Or is more more? If I can find a way to keep things short and simple I will. That is fine when working on my own although I’m not sure if this is always the best way to do things in a team environment.
Later this was added to instantiate the powerups upon death as well:
What needed to be fixed on Thursday:
The biggest thing that needed debugging on Thursday night was the HUD layout I created. The prefabs weren’t pushed up properly and it caused a lot of funky behavior. Towards the end while testing the weapon level ui component we also realized that the powerups were not dropping the level back down when the player was taking damage🙃.
Here was the original set up:
So, where I went wrong was that when I originally tested this there were no enemies yet so all I was doing was using a tester method to make sure that it set the weapon id to 0. I hadn’t playtested it with actual damage from the enemies we integrated earlier in the week and so never realized how keeping all of the switch statement logic in ontrigger was preventing it from switching the weapon back to the base even though the id was being brought down to 0. Uggghhhhh. We were testing/debugging everything together on my teammate’s computer so he helped me to update it. We both agreed that it would make more sense to have the switch statement logic in a separate method. From there basically everything stayed the same except instead of changing the weapon id to 0 , we now call the method that handles our UI health bar and in there our new SwitchPowerUp() gets called.
Here’s what it looks like now:
Other things that happened on Thursday that I forgot to blog about was:
↠Made HUD layout.
↠Added Explosions to Player Upon Death
↠Probably other things I’m forgetting at the moment.
Gotta do one more blog post today and I’ll be all caught up.
Talk to you soon.