From Photographer to Video Game Creator — Day 14
Today involved a lot of research. Let me put some emphasis on A LOT. I set out to give my Player ammo that deducts as they shoot and that turned out to be the least of my concerns…
Why and how was this so confusing for me. It literally had me staring at my computer with no idea what to try. I read through blog after blog attempting to understand how to attach multiple audio clips to a single object and have different actions trigger different sounds. I could make my game play one sound or all sounds at the same time. I was lost.
Finally things started to fall into place. I created a few audio clips identifying the sound clips I was going to use and serialized them so that I could assign the desired audio in the inspector.
Here are the assigned audio clips in the inspector.
Now for the tricky part. I needed to tell the Player to shoot and make laser sounds until ammo was equal to zero, then if the Player tried to shoot it would make a clicking sound and no laser would be fired. Also, if Triple Shot is active no ammo will be deducted until the powerup is deactivated. This code felt so good to get right!
I then created a method that could be called when the ammo was collected by the Player. This would set the ammo back to the desired amount and a reloading audio clip would be played! Now we are getting somewhere!
My last task of the day was creating the ammo object that the Player could collect to refill their ammo. I used a little Photoshop to create some clean looking bullets and then added a glowing background to it that pulses and changes colors between green and blue. I also made the ammo slightly fade in and out by adjusting the alpha and key framing the animation.
Today was frustrating at times, but turned out to be pretty productive in the end. I also really enjoyed reading all of the blogs and seeing how many different solutions can be made to create a similar result.