Added Sound

This commit is contained in:
Heli-o 2021-05-28 14:32:22 +02:00
parent 5ee5d8eecb
commit b1e72a16b0
12 changed files with 26 additions and 2 deletions

Binary file not shown.

View file

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Media;
namespace Catch_the_button {
class AudioSystem {
static SoundPlayer hit = new SoundPlayer("./resources/hit.wav");
static SoundPlayer miss = new SoundPlayer("./resources/miss.wav");
static internal void Hit() {
hit.Play();
}
static internal void Miss() {
miss.Play();
}
}
}

View file

@ -61,6 +61,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AudioSystem.cs" />
<Compile Include="Leaderboard.cs" />
<Compile Include="Main.cs">
<SubType>Form</SubType>

View file

@ -75,7 +75,6 @@ namespace Catch_the_button {
btn.Location = new Point((frm.Width - btn.Width) / 2, (frm.Height - btn.Height) / 2);
status = true;
timer.Interval = delay;
}
static void Go() { //first button hit
timer.Start();
@ -87,22 +86,27 @@ namespace Catch_the_button {
if (!status) return;
if (first) {
Go();
points++;
AudioSystem.Hit();
first = false;
return;
}
if (stpwch.ElapsedMilliseconds < 500 && !(obj is Form || obj is System.Timers.Timer)) {
AudioSystem.Hit();
points += 2;
if (points % milestoneCount == 0 && delay > 400) {
delay -= delaydown;
}
}
else if (stpwch.ElapsedMilliseconds >= 500 && !(obj is Form || obj is System.Timers.Timer)) {
AudioSystem.Hit();
points++;
if (points % milestoneCount == 0 && delay > 400) {
delay -= delaydown;
}
}
else if (obj is System.Timers.Timer || obj is Form) {
AudioSystem.Miss();
points--;
miss++;
formResetter.Start();

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
4ec7a7f8cafda8845629d58d71d67896e75d37b3
348d5ad308b3803dddd051ec17e7b10c11b6970d