Next class, and probably the class after, I will continue trying to get it to work. I might try to split them into separate "if(input..." scripts, instead of putting if statements inside an if statement.
Tuesday, May 23, 2017
Day 48: Audio-only Game: Day 23
The entire class, all I did was try to get the crossbow sounds work. I scrapped the original crossbow sound script and tried something a bit different, but it still isn't working. The problem is that it seems to skip the "if ((Distance == 100) && (Loaded != false) && (Loading != true));" script (which plays the shooting sound, and go straight to the script that plays the reload sound.
Thursday, May 18, 2017
Day 47: Audio-only Game: Day 22
Apparently Unity has a huge update, so it'll be a while before I can work on anything.
Once that was over, I still had enough time to add the other sounds. First of all, I added the sounds to the script.
Next, I made yet another delay script. This one will go between the sound of the crossbow shooting, and it reloading.
Once that was over, I still had enough time to add the other sounds. First of all, I added the sounds to the script.
Next, I made yet another delay script. This one will go between the sound of the crossbow shooting, and it reloading.
Wednesday, May 17, 2017
Day 46: Audio-only Game: Day 21
The first sound I added was the "sword unsheath" sound. I already had it assigned to the Unsheath storage variable, so all I needed was to put 3 lines of code in the right place, the one's starting with "this."
The first of the three lines gets the audiosource component that is attached to the player. The second one gets the sound from where it is stored in the variable. The third line plays it through the audiosource recognized by the first line.
I simply repeated this for the CrossbowEquip sound.
Next class I will add the attack and reload sounds.
The first of the three lines gets the audiosource component that is attached to the player. The second one gets the sound from where it is stored in the variable. The third line plays it through the audiosource recognized by the first line.
I simply repeated this for the CrossbowEquip sound.
Next class I will add the attack and reload sounds.
Friday, May 12, 2017
Day 45: Audio-only Game: Day 20
I found a sound file with literally every bow/crossbow/arrow sound from TES 5: Skyrim. All I needed to do was select one part of the file and click "Export selected". I chose to export them as a .wav file.
So now that I have crossbow sound effects, I can add them to my game. I simply imported them as assets, and they're ready to use.
In my Combat script, I added more audioclip 'variables', and assigned the appropriate sound to each.
I tested my script, just to make sure it still works, and it seems there's a problem. The raycasting and equipping mechanic isn't working. NONE of it is working, really. So now I have to go through the entire script to find what's wrong with it.
I've found a fix, but I just don't understand why it stopped working. In the void start function, I added a few lines that sets two of the booleans, and one integer. Apparently, since they weren't set before, the script couldn't use them since there were no values assigned.
Now that I've gotten that sorted out, I can continue with the sound...next class.
So now that I have crossbow sound effects, I can add them to my game. I simply imported them as assets, and they're ready to use.
In my Combat script, I added more audioclip 'variables', and assigned the appropriate sound to each.
I tested my script, just to make sure it still works, and it seems there's a problem. The raycasting and equipping mechanic isn't working. NONE of it is working, really. So now I have to go through the entire script to find what's wrong with it.
I've found a fix, but I just don't understand why it stopped working. In the void start function, I added a few lines that sets two of the booleans, and one integer. Apparently, since they weren't set before, the script couldn't use them since there were no values assigned.
Now that I've gotten that sorted out, I can continue with the sound...next class.
Day 44: Audio-only Game: Day 19
An "audio-only" game would be kind of pointless without sound effects. Most of what I will use I can find on SFX websites (licensing shouldn't be a problem since I'm not getting money from the game). However, I'll need a program to edit the sound files to fit my needs. For that, I decided to use Audacity: A free sound editor.
Now that that's done, I can look for sound effects. I found two "medieval" sound effects packs which includes sounds for swords, bows, and dozens others. Unfortunately, most of the blade-on-blade sounds are just light tapping. There's no real clash. So I probably won't be using many of those sounds.
Luckily, the unity asset store has some free sounds. I found a "woosh" sound that I will probably use for the sword swing.
To be able to play a sound effect using script, I needed to first add these two lines as variables. As seen here, I'm using an "unsheath" sound. Afterwards, I changed UnsheathSound to PlayerSound, since that audio source will be used for more than one sound.
I then inserted a line of code into the script that controls the sword selection, so if the sword is not equipped and "1" is pressed, the sound will play.
Next class I will add more sounds such as the sword swing, sheathing the sword, and the crossbow sounds.
Wednesday, May 10, 2017
Day 43: Audio-only Game: Day 18
I made the integer variable that would define the delay between dealing damage.
Then, in the weapon-switching script, I added lines to change the StrikeDelayInt variable when "1" or "2" is pressed, changing the delay according to the weapon being used.
It wasn't working properly, so I went through the script, and found that two lines were in the wrong order. I fixed it.
Then, to the weapon switching script, I added a condition that CanAttack must be true. That way, the player can't switch back and forth between weapons until the first one is completely usable.
Next class I will try to learn how to add sound effects.
Then, in the weapon-switching script, I added lines to change the StrikeDelayInt variable when "1" or "2" is pressed, changing the delay according to the weapon being used.
It wasn't working properly, so I went through the script, and found that two lines were in the wrong order. I fixed it.
Then, to the weapon switching script, I added a condition that CanAttack must be true. That way, the player can't switch back and forth between weapons until the first one is completely usable.
Next class I will try to learn how to add sound effects.
Monday, May 8, 2017
Day 42: Audio-only Game: Day 17
I decided to try something else for the raycast mechanic. Instead of the code that I originally had, I changed it to a fairly small function, and a couple lines that calls the function when the mouse is clicked.
It seems to work so far.
Now, no one should be able to swing a sword a dozen times a second, so I needed to add a delay. I used the same technique I used with the weapon switching, using IEnumerator and coroutines.
Now the player can only attack once per second. Obviously this is a bit fast for a bow, but it'll have to do for now.
Next class I'll add a variable for the attack delay that will change based on which weapon you're using. So the bow (I'm thinking of making it a crossbow now) will have a longer attack delay than the sword, which is supposed to simulate reloading the crossbow.
It seems to work so far.
Now, no one should be able to swing a sword a dozen times a second, so I needed to add a delay. I used the same technique I used with the weapon switching, using IEnumerator and coroutines.
Now the player can only attack once per second. Obviously this is a bit fast for a bow, but it'll have to do for now.
Next class I'll add a variable for the attack delay that will change based on which weapon you're using. So the bow (I'm thinking of making it a crossbow now) will have a longer attack delay than the sword, which is supposed to simulate reloading the crossbow.
Subscribe to:
Posts (Atom)

























