Sound Script

This week has sadly been a very slow week when it comes to the current game design work due to me catching a fever and needing to rest. As such I haven’t had the ability to do the work that I needed.

However I did manage to get a script working in the game that allows a sound effect for when you take damage.

When I started with this task I first tried at first to use the same method as last time in which I only added an audio component to the right prefab. My first thought was that I could add the component to a sprite when the character takes damage. However I quickly realized that the sprite didn’t exist as when the player takes damage it simply creates a red overlay. So I had to scrap that plan and instead start to learn how to make a script for it. This however wasn’t as easy as I had hoped. At first I used the Unity website to learn some basics regarding scripting, but it was hard since I had never done anything similar to that before. While guides were useful I still wasn’t making as much progress as I was needed to finish the task within time. So instead I asked my programmer and game designer to help me with the script and to teach me how it worked. When they helped me I realized that I had barely done anything right with the script since I had skipped several steps when I tried to rush it. As such I hadn’t defined the audio source in the script or even found the correct place to put the code later. Lastly there was also an error in my code since I used the wrong command, but luckily they helped me with that as well.

With their help I managed to get the code working in the end, but I also learned many important things about coding. First of all never rush tutorials. I realized too late that skipping the earliest parts of the tutorial made everything else impossible to fix for me. This was obvious when I couldn’t even define the audio source in the code.

But most important it taught me it is a good idea to ask for help with coding and try to learn from more experienced people since they have a better understanding than myself at this.

This is all for today. Have a nice day.scriptingintropic

Lämna en kommentar