Thursday, May 25, 2017

Day 50: Audio-Only Game: Day 25

When I opened up the game, I saw this:
It was a bit concerning, but it didn't seem like anything was broken...yet.

I decided to scrap the crossbow sound again, but this time, I'm going to build the script piece by piece, and test each part. That way, I'll be able to find what's wrong with it.

First of all, I starting with a simple script. All this does is, if the mouse button is clicked, and distance = 100, the crossbow shoot sound will be played.
It does exactly as expected, and plays the sound properly.

I then noticed that whenever I clicked, it created a new audiosource, and I had nothing in place to delete them.

To fix this, I added a "destroy" script that destroys the audiosource after 1 second.


Now to add the delay. This is tough, because I need it to work with the reload script as well. I used the AttackDelay function. I also used one of the booleans to prevent the crossbow from being shot during the delay.

Next class, I will add on to the script, and probably start on the reload sound script.





















No comments:

Post a Comment