Skip to content

Commit

Permalink
made better sound effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Perdue committed Mar 14, 2022
1 parent a9dd307 commit d13be7e
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 2 deletions.
Binary file added Assets/click.mp3
Binary file not shown.
Binary file added Assets/enemyDeath.wav
Binary file not shown.
Binary file added Assets/hit.wav
Binary file not shown.
Binary file added Assets/playerDeath.wav
Binary file not shown.
Binary file added Assets/waveDone.mp3
Binary file not shown.
Binary file added Assets/waveDone.wav
Binary file not shown.
6 changes: 4 additions & 2 deletions Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public override void Initialize()
base.Initialize();
attacking = false;
soundDone.Start();
damageSound = TileEngine.Instance.Sound.LoadSound("Sound/testSound.mp3");
damageSound = TileEngine.Instance.Sound.LoadSound("Sound/hit.wav");
}

public void CreateAndSetWeapon(Weapon weapon)
Expand Down Expand Up @@ -171,7 +171,9 @@ public void onDamage(float damage, float[] attackDirection, int pushAmt)
PushSelf(-(int)(attackDirection[0] * pushAmt), -(int)(attackDirection[1] * pushAmt));
if (!soundPlaying)
{
TileEngine.Instance.Sound.PlaySound(damageSound);
SoundInstance soundInstance = TileEngine.Instance.Sound.PlaySound(damageSound);
soundInstance.Volume = 0.3f;
soundInstance.Looping = false;
soundDone.Start();
soundPlaying = true;
}
Expand Down
2 changes: 2 additions & 0 deletions Characters/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text;
using System.Threading.Tasks;
using tileEngine.SDK;
using tileEngine.SDK.Audio;
using tileEngine.SDK.Components;
using tileEngine.SDK.Diagnostics;
using tileEngine.SDK.Input;
Expand Down Expand Up @@ -362,6 +363,7 @@ public override void Update(GameTime delta)
base.Update(delta);
if (health <= 0)
{
TileEngine.Instance.Sound.PlaySound(TileEngine.Instance.Sound.LoadSound("Sound/enemyDeath.wav"));
Scene = null;
player.score += scoreValue;
}
Expand Down
8 changes: 8 additions & 0 deletions Characters/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using tileEngine.SDK.Utility;
using tileEngine.SDK.GUI.Elements;
using tileEngine.SDK.GUI;
using tileEngine.SDK.Audio;

namespace CampusCrawl.Characters
{
Expand Down Expand Up @@ -119,6 +120,9 @@ public void respawn()

public void restart(Point location)
{
SoundInstance soundInstance = TileEngine.Instance.Sound.PlaySound(TileEngine.Instance.Sound.LoadSound("Sound/click.mp3"));
soundInstance.Volume = 0.3f;
soundInstance.Looping = false;
var scene = (Scenes.BaseScene)Scene;
scene.paused = false;
paused = false;
Expand All @@ -135,6 +139,10 @@ public void restart(Point location)

public void makePauseMenu()
{
SoundInstance soundInstance = TileEngine.Instance.Sound.PlaySound(TileEngine.Instance.Sound.LoadSound("Sound/playerDeath.wav"));
soundInstance.Volume = 0.3f;
soundInstance.Looping = false;
TileEngine.Instance.Sound.PlaySound(damageSound);
pausePanel = new Panel();
pausePanel.Colour = Color.CornflowerBlue;
pausePanel.Size = new Vector2(500, 250);
Expand Down
3 changes: 3 additions & 0 deletions Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class Game : TileEngineGame
private Label title;
public void startGame(Point location)
{
SoundInstance soundInstance = TileEngine.Instance.Sound.PlaySound(TileEngine.Instance.Sound.LoadSound("Sound/click.mp3"));
soundInstance.Volume = 0.3f;
soundInstance.Looping = false;
UI.RemoveElement(startButton);
UI.RemoveElement(guiImage);
UI.RemoveElement(title);
Expand Down
2 changes: 2 additions & 0 deletions Scenes/AlexandraSquare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void spawnReset()

public void waveReset()
{
if(waveCounter != 1)
TileEngine.Instance.Sound.PlaySound(TileEngine.Instance.Sound.LoadSound("Sound/waveDone.mp3"));
int timeElapsed = timeStart - (int)(DateTime.UtcNow - new DateTime(1000, 1, 1)).TotalSeconds;
if(((waveCounter * 30) - timeElapsed) * 5 > 0 && waveCounter != 1)
{
Expand Down
Binary file modified campus-crawl.teproj
Binary file not shown.

0 comments on commit d13be7e

Please sign in to comment.