add short music loop to demo stage

GitOrigin-RevId: 7ea3d773b12341eb3eb3aabd9000cc32014faac8
This commit is contained in:
Colin McMillen 2020-03-02 15:15:35 -05:00
parent 02b1dd4874
commit 29cf5eb0c9
2 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using MonoGame.Framework.Utilities; using MonoGame.Framework.Utilities;
@ -67,6 +68,10 @@ namespace SemiColinGames {
SoundEffects.Load(Content); SoundEffects.Load(Content);
Textures.Load(Content); Textures.Load(Content);
linesOfSight = new LinesOfSight(GraphicsDevice); linesOfSight = new LinesOfSight(GraphicsDevice);
SoundEffectInstance music = SoundEffects.IntroMusic.CreateInstance();
music.IsLooped = true;
music.Volume = 0.1f;
music.Play();
LoadLevel(); LoadLevel();
} }

View File

@ -4,9 +4,11 @@ using Microsoft.Xna.Framework.Content;
namespace SemiColinGames { namespace SemiColinGames {
public static class SoundEffects { public static class SoundEffects {
public static SoundEffect IntroMusic;
public static SoundEffect[] SwordSwings = new SoundEffect[4]; public static SoundEffect[] SwordSwings = new SoundEffect[4];
public static void Load(ContentManager content) { public static void Load(ContentManager content) {
IntroMusic = content.Load<SoundEffect>("music/playonloop/smash_bros_short");
SwordSwings[0] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_1"); SwordSwings[0] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_1");
SwordSwings[1] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_2"); SwordSwings[1] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_2");
SwordSwings[2] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_3"); SwordSwings[2] = content.Load<SoundEffect>("sfx/zapsplat/sword_whoosh_3");