Pt 9: Bug Fixes and Feature Implementation

4 0 0
                                    

09/05/2023 - So had a lot of ideas while at work for things I need to do and my next update, and I've at least got the game much closer to the MVP (Minimum Viable Product) I want it to be. Got the 10 month old to bed and played a game of League of Legends (trust me, I'm not actually toxic)... lost... then started coding.

My main goal this session was to implement the FPS mode bounding box that I've wanted to implement since like... day 2/3?

Trust me when I say this... I didn't even try to do it yet.

Instead I did bug fixes! And feature implementation! Just like the title says :D


So to start, I needed a way to track ammo in game. Most games typically have an ammo counter on the bottom right, so started to implement that. Using TextMeshPro didn't update properly, but using Legacy > Text UI features made it look blurry. Then Bob (ChatGPT) reminded me how to implement TextMeshPro and I got it to work in a snap! Tweaked the settings and outside of it reading "0|0 Null" when nothing was equipped... It worked perfect!

So I then tried to exclude the ammo counter when the ammo count was null... Nothing. Then tried when weapon name was null... still didn't work. So then I tried when weapon name was 'null' - worked perfect. Basically since the string variable was technically listed as 'null', I just had to strictly look for that.

After that, I still couldn't bother with doing the bounding box, looked at the time, saw I should sleep in an hour and was like... Fixing the 'wave manager' shouldn't be too bad. Turns out I was right.

Previously I was trying to keep track of number of zombies killed, when hit the same number as the number supposed to be spawned, start next wave after 2 seconds. Well, that worked once or twice, but I think when something died via multiple bullets by the shotgun, it would trigger to increase the dead zombie counter for each bullet and either skip the value altogether, or start the next wave early. 

What I did instead was basically trigger the waves by setting a bool in the playerscript that only updated when the first weapon was grabbed - this way players can't start the wave without having a way to defend themselves. While that bool is true, check if another bool is false. If it is, then turn the latter one true (called this the 'lockBool') and set 'allowSpawn' to true.

Now when 'allowSpawn' is true, it immediately sets itself to false but starts a wave. 

Once the zombie death counter is the same as the spawn counter, 'allowSpawn' turns to true again to start the next with an ever increasing integer. 

As for stopping it from counting the death multiple times, basically have a bool in the zombie that when they die, if bool is false, change it to true, increase death counter, and delete zombie. This stopped from it counting the death multiple times (appropriately the bool was called 'once' because I'm creative).

And that my avid follower, is how I fixed the wave system and set up an ammo counter in the time span of about 2 hours of screwing around and finding out.

Zombies and the One Hand Army - Dev LogsDär berättelser lever. Upptäck nu