Learning Journal:
This week, being Week 14, we had two classes instead of just one (which I've merged into one Learning Journal entry). This was to ensure that we had enough time to get our final assignments finished, including all of the elements we needed to hit our L.O.s. We began by learning how to add audio clips to our games as background music. First, you have to make sure that the camera is attached to the player as a child object, as the camera automatically has an Audio Listener component. Without this, the sound will not work. After setting up the scene, you create an empty GameObject which will be the audio source. You then add an Audio Source component to it and download import the clip that you want to play. I decided to add a sound to the key object to signify that it was successfully picked up, and later added some background ambience. I used Pixabay (n.d.) to download my audio. Having imported the clip and set it to the Audio Source, I changed some of the settings so that it wouldn't loop or play on awake, but also so that the player would be able to hear it properly.
Next, Glenn taught us how to add an audio script that would allow for things like footsteps, particularly so that the individual 'steps' would not overlap and cut each other out. The template that he gave us on Tuesday was:
void OnTriggerEnter()
{
//audioSource.play();
audioSource.PlayOneShot([audioClipName]);
}
but when I tried to actually use it at home, something kept going wrong. After some consideration in Thursday's class, we discovered that the Unity syntax and application for the PlayOneShot function had changed. The new, working function can be found under Brief 3 on my Assignments page. I also learned how to add an array of clips that can be called randomly using the PlayOneShot script. This could be useful for having a series of slightly different footstep sounds so that it doesn't sound monotonous in-game. The line for this is
audioSource.PlayOneShot(footstep[Random.Range(0,footstep.Count-1)]);
I haven't yet tried this out to see if it works.
Finally, we went over particle systems and how to create them. An example of a use would be a fire sprite, where each particle is a different frame. First, you create an empty GameObject and add a Particle System component. The Unity Asset Store seems to be a good place to get sprite sequences and such. You then assign the sprite as the particle material and adjust the settings as needed. In games, particle systems are commonly used for atmospheric elements such as mist and rain, because they do not generate new game objects which would eat up run time.
When I checked over the requirements for Brief 3, it was my understanding that we did not need to have a particle system in our games. However, when I looked back on Week 14a of CampusOnline, I saw a prompt to create one, so I quickly put one together at home. This was a bit frustrating, because I hadn't given any thought to how I wanted to implement particles into my game, as I didn't think I needed to.
I've also come to realise that I'm not going to have a working, playable game by the end of the trimester. This is disappointing, because I wanted to create something that I could share with others, but I understand that I may have been too ambitious. I think if I'd had more time to work on it and get personalised assistance to do so, I would've been able to make an actual game and meet my high concept. At times, this unit - and in particular this project - were extremely stressful. While I enjoyed it when my scripts worked, especially when I did it mostly by myself, the Enemy AI gave me constant trouble and I couldn't sort it out.
Pixabay.com. (n.d.). Free Game Sound Effects Download. Retrieved September 2, 2022 from https://pixabay.com/sound-effects/search/game/