public override void Load() { try { m_AudioEngine = new AudioEngine(m_RootDirectory + "sounds.xgs"); if (m_AudioEngine != null) { m_WaveBank = new WaveBank(m_AudioEngine, (m_RootDirectory + "Wave Bank.xwb")); m_SoundBank = new SoundBank(m_AudioEngine, (m_RootDirectory + "Sound Bank.xsb")); // Get sound categories AudioCategory soundCategory = m_AudioEngine.GetCategory("Sounds"); AudioCategory musicCategory = m_AudioEngine.GetCategory("Music"); // Set into the custom categories m_SoundCategory = new CustomAudioCategory(soundCategory); m_MusicCategory = new CustomAudioCategory(musicCategory); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public void LoadContent(string path) { engine = new AudioEngine(path + "sounds.xgs"); sounds = new SoundBank(engine, path + "Sound Bank.xsb"); waves = new WaveBank(engine, path + "Wave Bank.xwb"); categories = new Dictionary<string, AudioCategory>(); categories.Add("Music", engine.GetCategory("Music")); categories.Add("Default", engine.GetCategory("Default")); }
private SoundManager() { AudioEngine = new AudioEngine(@"Content/Sound/Sound.xgs"); WaveBank = new WaveBank(AudioEngine, @"Content/Sound/Wave Bank.xwb"); SoundBank = new SoundBank(AudioEngine, @"Content/Sound/Sound Bank.xsb"); // ボリュームの設定 AudioEngine.GetCategory("BGM").SetVolume(0.8f); AudioEngine.GetCategory("SE").SetVolume(1.0f); }
static Audio() { //Ladda in ljud-resurser audioEngine = new AudioEngine("Content/Audio/sounds.xgs"); waveBank = new WaveBank(audioEngine, "Content/Audio/Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content/Audio/Sound Bank.xsb"); //Kategori på ljud i xact-projektet music = audioEngine.GetCategory("Music"); soundEffects = audioEngine.GetCategory("Sound Effects"); }
/// <summary> /// Private constructor as per the Singleton pattern which reads the /// compiled sound files into memory. /// </summary> private SoundEngine() { // These files are automatically created in the output directory // matching the relative path of wherever the .xap file is located m_audio = new AudioEngine(@"Content\Audio\sounds.xgs"); m_waveBank = new WaveBank(m_audio,@"Content\Audio\waves1.xwb"); m_soundBank = new SoundBank(m_audio,@"Content\Audio\sounds1.xsb"); AudioCategory music = m_audio.GetCategory("Music"); music.SetVolume(1f); AudioCategory effects = m_audio.GetCategory("Effect"); effects.SetVolume(1f); }
/// <summary> /// AudioController Constructor. /// Initializes AudioEngine, SoundBank and WaveBank. /// </summary> private AudioController() { String path = System.Environment.CurrentDirectory; path = path.Replace(@"\bin\Debug", @"\Resources"); audioEngine = new AudioEngine(path + @"\sound.xgs"); WaveBank = new WaveBank(audioEngine, path + @"\Wave Bank.xwb"); SoundBank = new SoundBank(audioEngine, path + @"\Sound Bank.xsb"); NoteCategory = audioEngine.GetCategory("Notes"); NoteCategory.SetVolume(3.0f); AudioCategory BackgroundCategory = audioEngine.GetCategory("Background sound"); BackgroundCategory.SetVolume(2.0f); }
public override void Initialize() { base.Initialize(); m_AudioEngine = new AudioEngine(@"Content\Audio\GameSounds.xgs"); m_WaveBank = new WaveBank(m_AudioEngine, @"Content\Audio\Wave Bank.xwb"); m_SoundBank = new SoundBank(m_AudioEngine, @"Content\Audio\Sound Bank.xsb"); m_MusicCategory = m_AudioEngine.GetCategory("Music"); m_EffectsCategory = m_AudioEngine.GetCategory("Default"); // r_Factory.SetSoundBank(m_SoundBank); m_Music = m_SoundBank.GetCue("BGMusic"); m_Music.Play(); }
/// <summary> /// Create sound /// </summary> static Sound() { try { string dir = Directories.SoundsDirectory; audioEngine = new AudioEngine( Path.Combine(dir, "XnaShooter.xgs")); waveBank = new WaveBank(audioEngine, Path.Combine(dir, "Wave Bank.xwb")); // Dummy wavebank call to get rid of the warning that waveBank is // never used (well it is used, but only inside of XNA). if (waveBank != null) soundBank = new SoundBank(audioEngine, Path.Combine(dir, "Sound Bank.xsb")); // Get the music category to change the music volume and stop music musicCategory = audioEngine.GetCategory("Music"); } // try catch (Exception ex) { // Audio creation crashes in early xna versions, log it and ignore it! Log.Write("Failed to create sound class: " + ex.ToString()); } // catch }
public ScreenManager(Game game) : base(game) { // Start background music audioEngine = new AudioEngine(@"Content\Audio\boardClickSound.xgs"); soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb"); waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb"); audioCategory = audioEngine.GetCategory("background"); }
public AudioManager(Game1 currentGame) { game = currentGame; engine = new AudioEngine("Content\\SFX\\SFX.xgs"); soundBank = new SoundBank(engine, "Content\\SFX\\Sound Bank.xsb"); waveBank = new WaveBank(engine, "Content\\SFX\\Wave Bank.xwb"); fxCat = engine.GetCategory("SFX"); fxCat.SetVolume(10f); }
public AudioManager() { engine = new AudioEngine("Content/Sound/XACT Sound File.xgs"); waves = new WaveBank(engine, "Content/Sound/Wave Bank.xwb"); sounds = new SoundBank(engine, "Content/Sound/Sound Bank.xsb"); soundEffectCategory = engine.GetCategory("Sound Effect"); soundEffectCategory.SetVolume(sfxVolume); backgroundMusicCategory = engine.GetCategory("Music"); backgroundMusicCategory.SetVolume(backgroundVolume); //the default gun sound was much too loud, so I created its own category to set the //volume for only that sound gunshotCategory = engine.GetCategory("Gunshot"); gunshotCategory.SetVolume(gunshotVolume); Cue startSplashMusic = sounds.GetCue("Drum n Bass D Coexistant"); playFirstBackgroundMusic(startSplashMusic); }
public static void Initialize() { audioEngine = new AudioEngine(@"Content\audio\AudioProject.xgs"); soundBank = new SoundBank(audioEngine, @"Content\audio\SoundBank.xsb"); waveBank = new WaveBank(audioEngine, @"Content\audio\WaveBank.xwb"); soundCategory = audioEngine.GetCategory("Sound"); moveLoop1 = soundBank.GetCue("move_loop_1"); moveLoop2 = soundBank.GetCue("move_loop_2"); moveLoop3 = soundBank.GetCue("move_loop_3"); }
public MusicManager(float lightThreshold, float darkThreshold) { LightThreshold = lightThreshold; DarkThreshold = darkThreshold; audioEngine = new AudioEngine("Content/audio/test.xgs"); waveBank = new WaveBank(audioEngine, "Content/audio/Wave Bank1.xwb"); soundBank = new SoundBank(audioEngine, "Content/audio/Sound Bank.xsb"); light = audioEngine.GetCategory("Light"); dark = audioEngine.GetCategory("Dark"); light2 = audioEngine.GetCategory("Light2"); dark2 = audioEngine.GetCategory("Dark2"); CurrentStage = 0; NextStage = 0; light.SetVolume(0.0f); dark.SetVolume(0.0f); light2.SetVolume(0.0f); dark2.SetVolume(0.0f); }
public AudioPlayer(ContentManager content) { engine = new AudioEngine("Content/Sounds/RecellectionSounds.xgs"); waves = new WaveBank(engine, "Content/Sounds/Wave Bank.xwb"); sounds = new SoundBank(engine, "Content/Sounds/Sound Bank.xsb"); soundCategory = engine.GetCategory("Default"); soundVolume = 1.0f; songs = new Song[1]; songs[0] = content.Load<Song>("Sounds/Songs/Castlevania"); MediaPlayer.IsMuted = true; }
private SoundManager(Game game, Func<Vector3> getListenerPosition, Func<Vector3> getListenerForward, Func<Vector3> getListenerUp) : base(game) { audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb"); musicCategory = audioEngine.GetCategory("Default"); volume = 10; musicCategory.SetVolume(volume); cuelist = new List<Cue>(); BGMCuelist = new List<Cue>(); updateListenerForward = getListenerForward; updateListenerUp = getListenerUp; updateListenerPosition = getListenerPosition; listener = new AudioListener(); }
public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader) { _priority = reader.ReadInt32(); int volume = reader.ReadInt32(); double attenuation_in_db = volume / 100.0f; GSGE.Debug.assert(attenuation_in_db <= 0); gain = (float)Math.Pow(10, attenuation_in_db / 20.0); GSGE.Debug.assert(gain <= 1.0f); _pitch = (float)(reader.ReadInt32() / 100.0f); int trackCount = reader.ReadInt32(); _tracks = new TrackHelper[trackCount]; for (int i = 0; i < trackCount; i++) { _tracks[i] = new TrackHelper(reader); } int strLen = reader.ReadInt16(); byte[] bytes = reader.ReadBytes((int)strLen); string catname = Encoding.ASCII.GetString(bytes); category = audioengine.GetCategory(catname); int rpcCount = reader.ReadInt32(); rpcs = new RPCCurve[rpcCount]; for (int i = 0; i < rpcCount; i++) { strLen = reader.ReadInt16(); bytes = reader.ReadBytes((int)strLen); string rpc = Encoding.ASCII.GetString(bytes); rpcs[i] = audioengine.GetRPC(rpc); } strLen = reader.ReadInt16(); bytes = reader.ReadBytes((int)strLen); effect = Encoding.ASCII.GetString(bytes); }
} // enum Sounds #endregion #region Constructor /// <summary> /// Create sound /// </summary> static Sound() { try { audioEngine = new AudioEngine(@"Content\Sounds\GameSounds.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Sounds\Wave Bank.xwb"); if (waveBank != null) soundBank = new SoundBank(audioEngine, @"Content\Sounds\Sound Bank.xsb"); // Get the music category to change the music volume and stop music musicCategory = audioEngine.GetCategory("Music"); } // try catch (Exception ex) { Log.Instance.Write("Failed to create sound class: " + ex.ToString()); } // catch } // Sound()
public void Initialize(IServiceProvider serviceProvider,Options options) { popUpText = new DrawableText(); content = new ContentManager(serviceProvider, "Data"); popUpText.font = content.Load<SpriteFont>("Stuff\\Arial"); popUpBG = content.Load<Texture2D>("Stuff\\popUpBG"); popUpText.Text = ""; popUpText.color = Color.White; this.options = options; options.MusicVolumeChanged += new MusicVolumeChangedEventHandler(options_MusicVolumeChanged); options.ResolutionChanged += new ResolutionChangedEventHandler(options_ResolutionChanged); audioEngine = new AudioEngine(GameConstants.AUDIO_PATH + "Music.xgs"); waveBank = new WaveBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xwb"); soundBank = new SoundBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xsb"); menuCategory = audioEngine.GetCategory("Music"); graphXPackCategory = menuCategory; menuCategory.SetVolume(options.MusicVolumeFloat); playList = FileManager.GetFileDictString(GameConstants.MENU_PLAYLIST); currentPlaylist = playList; oldVolume = options.MusicVolumeFloat; currentVolume = options.MusicVolumeFloat; currentCategory = menuCategory; CreatePopUpRectangle(options.Resolution); }
public DrumPlayer(AudioEngine audioEngine) { barSizeInClicks = music.TimeSignature.number * music.ClicksPerBeat; random = new Random(); #region Loading Drums instruments = new LinkedList<Instrument>(); instruments.Add(new Instrument(200, "bassdrum")); instruments.Add(new Instrument(10, "tambourine")); instruments.Add(new Instrument(200, "kickdrum")); instruments.Add(new Instrument(200, "snaredrum")); instruments.Add(new Instrument(10, "kettledrum")); instruments.Add(new Instrument(10, "triangle")); instruments.Add(new Instrument(10, "rattle")); instruments.Add(new Instrument(100, "hihat")); instruments.Add(new Instrument(10, "cowbell")); #endregion #region DrumLoop initialization int[][] loopTrace = new int[NO_OF_INSTRUMENTS][]; bool[] playing = new bool[NO_OF_INSTRUMENTS]; for (int i = 0; i < NO_OF_INSTRUMENTS; i++) { loopTrace[i] = InitializeEmptyLoop(barSizeInClicks); } loopTrace[(int)InstrumentName.bassdrum] = InitializeLoop(barSizeInClicks, 1, (int)InstrumentName.bassdrum); playing[(int)InstrumentName.bassdrum] = true; int[][] futureLoopTrace = new int[loopTrace.Length][]; bool[] futurePlaying = new bool[playing.Length]; for (int i = 0; i < loopTrace.Length; i++) { futureLoopTrace[i] = new int[loopTrace[i].Length]; Array.Copy(loopTrace[i], futureLoopTrace[i], loopTrace[i].Length); } Array.Copy(playing, futurePlaying, playing.Length); drumLoop = new DrumLoop(loopTrace, playing, futureLoopTrace, futurePlaying); #endregion this.audioEngine = audioEngine; soundBanks = new LinkedList<SoundBank>(); soundBanks.Add(new SoundBank(audioEngine, "Content/Drum Sound.xsb")); //Calling onBar twice because of the needs to initialize the voices in the model and the drumLoop //both of these need to know what is going to happen next bar. OnBar(); OnBar(); audioEngine.GetCategory("Drums").SetVolume(drumVolume); }
public override void Initialize() { spriteBatch = new SpriteBatch(Game.GraphicsDevice); creditosList = new List<Mapa>(); creditosList2 = new List<Mapa>(); tiempoEmpiezo = 0; pararCreditos = false; audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb"); waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb"); soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb"); musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb"); musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb"); ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb"); ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb"); musicCategory = audioEngine.GetCategory("Default"); musicCategory.SetVolume(0); reproducirMusica("batidora"); puntero = new StaticSprite( Game.Content.Load<Texture2D>(@"Images/cursor"), new Vector2(0, 0), new Point(24, 28), new Point(5, 5), new Point(0, 0), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.9f); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (455 / 2), (768 / 2) - 145), new Point(455, 142), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366/2)-(807/2), 768), new Point(807, 104), new Point(0, 0), new Point(0, 160), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (324 / 2), 768 + 120), new Point(324, 45), new Point(0, 0), new Point(0, 600), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/pj"), new Vector2((1366 / 2) - (194 / 2), 950), new Point(194, 178), new Point(0, 0), new Point(0, 0), new Point(4, 0), new Vector2(0f, 0), 0f, 300, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (383 / 2), 1152), new Point(383, 97), new Point(0, 0), new Point(0, 274), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (324 / 2), 1152 + 120), new Point(324, 45), new Point(0, 0), new Point(0, 600), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/growlie"), new Vector2((1366 / 2) - (87 / 2), 1370), new Point(87, 88), new Point(0, 0), new Point(0, 0), new Point(3, 1), new Vector2(0f, 0), 0f, 500, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (375 / 2), 1470), new Point(375, 105), new Point(0, 0), new Point(0, 374), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (324 / 2), 1470 + 120), new Point(324, 45), new Point(0, 0), new Point(0, 600), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/kiel"), new Vector2((1366 / 2) - (180 / 2), 1670), new Point(180, 200), new Point(0, 0), new Point(0, 0), new Point(4, 1), new Vector2(0f, 0), 0f, 500, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (912 / 2), 1870), new Point(912, 121), new Point(0, 0), new Point(0, 479), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (498 / 2), 1870 + 120), new Point(498, 49), new Point(0, 0), new Point(0, 644), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (500 / 2), 1990 + 70), new Point(500, 50), new Point(0, 0), new Point(0, 692), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (626 / 2), 2060 + 70), new Point(626, 52), new Point(0, 0), new Point(0, 749), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); creditosList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/creditos"), new Vector2((1366 / 2) - (168 / 2), 2330), new Point(168, 174), new Point(0, 0), new Point(0, 809), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //parallaxLayers[0].TexturesDay = Content.Load<Texture2D>("Parallax\\City_Background"); //parallaxLayers[0].TexturesDay = Content.Load<Texture2D>("Parallax\\Forest1_Background"); //parallaxLayers[1].TexturesDay = Content.Load<Texture2D>("Parallax\\City_middleground"); //parallaxLayers[1].TexturesDay = Content.Load<Texture2D>("Parallax\\Forground 1"); //parallaxLayers[2].TexturesDay = Content.Load<Texture2D>("Parallax\\City_construction"); //parallaxLayers[2].TexturesDay = Content.Load<Texture2D>("Parallax\\Forest1_foreground"); parallaxLayers[0].TexturesDay = Content.Load<Texture2D>("Parallax\\MyCityBackground"); parallaxLayers[0].TexturesDay = Content.Load<Texture2D>("Parallax\\Forest1_Background"); parallaxLayers[0].TexturesDay = Content.Load<Texture2D>("Parallax\\Bridge - Image 3"); parallaxLayers[1].TexturesDay = Content.Load<Texture2D>("Parallax\\City_construction"); parallaxLayers[1].TexturesDay = Content.Load<Texture2D>("Parallax\\MyBlank"); parallaxLayers[1].TexturesDay = Content.Load<Texture2D>("Parallax\\MyBlank"); parallaxLayers[2].TexturesDay = Content.Load<Texture2D>("Parallax\\City_foreground"); parallaxLayers[2].TexturesDay = Content.Load<Texture2D>("Parallax\\Forest1_foreground"); parallaxLayers[2].TexturesDay = Content.Load<Texture2D>("Parallax\\Bridgelevel_foreground"); nightOverlay = Content.Load<Texture2D>("Parallax\\Night_layer"); audioEngine = new AudioEngine(Content.RootDirectory + "//Sound//DagOgNatt.xgs"); waveBankBackground = new WaveBank(audioEngine, Content.RootDirectory + "//Sound//Background.xwb"); waveBankSoundEffects = new WaveBank(audioEngine, Content.RootDirectory + "//Sound//SoundEffects.xwb"); soundBankBackground = new SoundBank(audioEngine, Content.RootDirectory + "//Sound//Background.xsb"); soundBankHeartBeat = new SoundBank(audioEngine, Content.RootDirectory + "//Sound//HeartBeat.xsb"); soundBankMusic = new SoundBank(audioEngine, Content.RootDirectory + "//Sound//Music.xsb"); soundBankSoundEffects = new SoundBank(audioEngine, Content.RootDirectory + "//Sound//SoundEffects.xsb"); soundBankWalking = new SoundBank(audioEngine, Content.RootDirectory + "//Sound//Walking.xsb"); ambiance = "ForestDusk"; currentAmbiance = soundBankBackground.GetCue(ambiance); currentAmbiance.Play(); walkingSound = soundBankWalking.GetCue("Walking"); heartbeat = "HeartbeatForestDawn"; currentHeartbeat = soundBankHeartBeat.GetCue(heartbeat); heartbeatCategory = audioEngine.GetCategory("Heartbeat"); heartbeatCategory.SetVolume(0.2f); dogBark = soundBankSoundEffects.GetCue("MonsterWolfBark"); soundEffectsCategory = audioEngine.GetCategory("SoundEffects"); soundEffectsCategory.SetVolume(0.2f); //player.Texture = Content.Load<Texture2D>("Player\\Walk0000"); player.Texture = Content.Load<Texture2D>("Player\\WalkLoopSheet_05"); //startButton.TextureDay = Content.Load<Texture2D>("Start Game Btn Large size"); startScreen.TextureDay = Content.Load<Texture2D>("StartScreen"); player.TextureDie = Content.Load<Texture2D>("Player\\deathAnimation"); gate.TextureDay = Content.Load<Texture2D>("Gate"); excavator.TextureDay = Content.Load<Texture2D>("Plant"); //excavator.Song = Content.Load<Song>("Song\\excavator"); monster.TextureDay = Content.Load<Texture2D>("UlvMonsterHode_Spritesheet5x5"); pulse.TextureDay = Content.Load<Texture2D>("Hjertebank"); score.TextureDay = Content.Load<Texture2D>("SolUI"); bushCan.TextureDay = Content.Load<Texture2D>("Kanne i busk"); numbOne.TextureDay = Content.Load<Texture2D>("numbers"); flower.TextureDay = Content.Load<Texture2D>("Flower_01"); flower.TextureNight = Content.Load<Texture2D>("Flower_02"); doneFlower.TextureDay = Content.Load<Texture2D>("Flower_03"); //heartbeat = Content.Load<Song>("Song\\Heartbeat"); player.TextureRun = Content.Load<Texture2D>("Player\\RunLoopSheet_02"); bridge.TextureDay = Content.Load<Texture2D>("Parallax\\Bridge_night"); player.TextureCan = Content.Load<Texture2D>("WaterCanWalkSheet_01"); player.TextureWatering = Content.Load<Texture2D>("PouringSheet_01"); wolf.TextureDay = Content.Load<Texture2D>("Image 2_Wolf_day"); wolf.TextureNight = Content.Load<Texture2D>("Image 2_Wolf_night"); // dayOne = Content.Load<Song>("Song\\music.full.dawn"); // nightOne = Content.Load<Song>("Song\\music.full.dusk"); //MediaPlayer.IsRepeating = true; //MediaPlayer.Volume = 0.3f; //MediaPlayer.Play(heartbeat); Mouse.WindowHandle = this.Window.Handle; mouseTexture = Content.Load<Texture2D>("Cursor_v03"); // Menu button events menuButtons[0].TextureDay = Content.Load<Texture2D>("StartGameButtonSmallSize"); menuButtons[0].clicked += new Button.EventHandler(ButtonClicked); menuButtons[1].TextureDay = Content.Load<Texture2D>("StartGameButtonSmallSize"); menuButtons[1].clicked += new Button.EventHandler(ButtonClicked); }
//+++++++++++++++++++++++ INITIALIZE +++++++++++++++++ /// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { rnd = new Random(); texto = ""; tiempoMuertoKielTotal = 7000; estaEnSuSitio = false; kielMuertoSprite = false; tiempoMuertoKiel = 0; kielMuerto = false; tocaRayoKiel = false; tiempoTocaRayoKiel = 5000; currMouseState = Mouse.GetState(); lastMouseState = Mouse.GetState(); fondo = false; completoDelTo = false; tiempoFin = 0; collisionOffSet = Point.Zero; cayendo = false; tiempoLluvia = 0; densidadLluvia2 = 500; tiempoLluvia2 = 0; colision = 0; colisiond = 0; colisioni = 0; parada = 0; alturaTerreno = 4; jumpTimer = -10f; tiempoVelocidadSalto = 0; mundo1 = new Mundo(2.2f); currentDisparoState = DisparoState.Quieto; currentGravedadState = GravedadState.Aire; borrarBala = false; filas = 20; columnas = 0; count = 0; spriteList = new List<AutomatedSprite>(); kiel = new List<JefeFinal>(); disparoList = new List<Disparo>(); lluviaList = new List<Disparo>(); lluviaList2 = new List<Disparo>(); mapaList = new List<Mapa>(); terrenoList = new List<Mapa>(); terrenoList2 = new List<Mapa>(); terrenoListSuelo = new List<Mapa>(); fondoList1 = new List<Mapa>(); fondoList2 = new List<Mapa>(); map = new List<Point>(); disparoJefeList = new List<Mapa>(); jefeList = new List<Jefe>(); vidaList = new List<Mapa>(); vidaList2 = new List<Mapa>(); vidaListKiel = new List<Mapa>(); vidaList2Kiel = new List<Mapa>(); tigres = new List<Mapa>(); maxPosBloque = 0f; terrenoTiempoPasado = 0; terrenoDireccion = 0; terrenoDireccionAnterior = 4; terrenoTiempo = 100; temblorTerrenoTime = 0; temblorTerrenoElec = 0; temblorTerrenoNivel = 3; arrastre = 0; //Lluvia densidadLluvia = 500; //milisegundos entre mota velocidadLluvia = 6f; viento = -2; enemySpawnMinMilliseconds = 1000; enemySpawnMaxMilliseconds = 2000; enemyMinSpeed = 2; enemyMaxSpeed = 6; nextSpawnTime = 0; //Variables jefe respawnJefeMin = 0; respawnJefeMax = 1; //Posiciones posicionTerrenoX = 0; posicionTerrenoY = 700; posicionTerrenoBase = 0; posicionFondo1 = -1000; posicionFondo2 = -1000; //Disparo delayDisparo = 200; delayDisparoCurrent = 900; animaDisparo = 0; //Monsturo heridoDelayCurrent = 0; //Mapa cambioMapaDelay = 8000; cambioMapaDelayCurrent = 0; hastaMapa1 = 8000; hastaMapa2 = 15000; currentParteMapa = ParteMapa.Suelo; numFondo1 = 0; numFondo2 = 0; numTerreno1 = 0; capaTerreno = 0.5f; //Muerte caido = false; puntosControl = new List<float>(); puntoControl = 0; vidaPos = 0; vidaPosKiel = 0; tiempoHerido = 500f; tiempoMuerto = 0; muertoDelTo = false; for (int n = 0; n < 200; n++) map.Add(new Point(2, 0)); spriteBatch = new SpriteBatch(Game.GraphicsDevice); audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb"); waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb"); soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb"); musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb"); musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb"); ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb"); ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb"); musicCategory = audioEngine.GetCategory("Default"); musicCategory.SetVolume(0); //disparoJefeList.Add(new Mapa( // Game.Content.Load<Texture2D>(@"Images/DisparoJefe"), // new Vector2(kiel.getPlayerPosition.X + posxDisparoKiel, kiel.getPlayerPosition.Y), // new Point(0, 0), // new Point(200, 200), // new Point(0, 0), // new Point(4, 1), // new Vector2(0f, 0), // 0f, // 1000, 0.89f)); complete = new Mapa( Game.Content.Load<Texture2D>(@"Images/LevelComplete"), new Vector2(120, 120), new Point(1140, 496), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f); vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos += 7; for (int i = 0; i < 28; i++) { vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(1, 0), new Point(1, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos += 7; } vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(2, 0), new Point(2, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos = 0; vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(0, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; for (int i = 0; i < 28; i++) { vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(1, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; } vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(2, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; //Vida de kiel vidaListKiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPosKiel += 7; for (int i = 0; i < 98; i++) { vidaListKiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(1, 0), new Point(1, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPosKiel += 7; } vidaListKiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(2, 0), new Point(2, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPosKiel = 0; vidaList2Kiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(0, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPosKiel += 7; for (int i = 0; i < 98; i++) { vidaList2Kiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(1, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPosKiel += 7; } vidaList2Kiel.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"), new Vector2(500 + vidaPosKiel, 30), new Point(10, 23), new Point(0, 0), new Point(2, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPosKiel += 7; player = new UserControlledSprite( Game.Content.Load<Texture2D>(@"Images/pj"), new Vector2((1366 / 2) - 152, 300), new Point(194, 178), new Point(collisionOffSet.X, collisionOffSet.Y), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 70, 0.80f, 30); pointer = new StaticSprite( Game.Content.Load<Texture2D>(@"Images/cursor"), new Vector2(0, 0), new Point(24, 28), new Point(5, 5), new Point(0, 0), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.9f); reproducirMusica("kiel"); reproducirAmbiente("viento"); trackCue = soundBank.GetCue("caido"); trackCue2 = soundBank2.GetCue("bicho1"); //Suelo(-100, posicionTerrenoY, 0, -600, terrenoList); SueloGrande(0, posicionTerrenoY, 0, -100, terrenoList); SueloGrande(posicionTerrenoX + 1000, posicionTerrenoY, 0, 0, terrenoList); Escaleras(-400 , posicionTerrenoY - 200, 600, 0, 2, terrenoList2, 0.210f, true); kiel.Add(new JefeFinal( Game.Content.Load<Texture2D>(@"Images/kiel"), new Vector2(500, 20), new Point(180, 200), new Point(80, 30), new Point(0, 0), new Point(4, 2), new Vector2(5, 5), 0f, 400, 0.95f, 100)); final = new Mapa( Game.Content.Load<Texture2D>(@"Images/final"), new Vector2(posicionTerrenoX + 2000, posicionTerrenoY - 146), new Point(171, 156), new Point(0, 0), new Point(0, 1), new Point(4, 3), new Vector2(0f, 0), 0f, 200, 0.9f); posicionTerrenoX = 0; posicionTerrenoY = 0; //Escaleras(posicionTerrenoX + 600, posicionTerrenoY, 100, 10, 10, terrenoList2, 0.210f, true); //SegundoPlano(); foreach (Sprite s in terrenoList2) { s.getEscala = 0.8f; s.GetCollisionOffSet = new Point(60, 60); } puntuacionFuente = Game.Content.Load<SpriteFont>(@"Fuentes\fuente"); player.setTamAura = 300; foreach (Sprite s in jefeList) s.setTamAura = 400; }
public static void LoadSounds(ContentManager content) { _audioEngine = new AudioEngine(content.RootDirectory + "//BomberbroAudio.xgs"); _waveBankTheme = new WaveBank(_audioEngine, content.RootDirectory + "//Theme.xwb"); _soundBankTheme = new SoundBank(_audioEngine, content.RootDirectory + "//Theme.xsb"); _waveBankSoundEffect = new WaveBank(_audioEngine, content.RootDirectory + "//SoundEffects.xwb"); _soundBankSoundEffect = new SoundBank(_audioEngine, content.RootDirectory + "//SoundEffect.xsb"); _currentSong = _soundBankTheme.GetCue("Theme"); _explosion2 = _soundBankSoundEffect.GetCue("Explosion 2"); _cancel1 = _soundBankSoundEffect.GetCue("Cancel 1"); _cancel2 = _soundBankSoundEffect.GetCue("Cancel 2"); _collision1 = _soundBankSoundEffect.GetCue("Collision 1"); _collision2 = _soundBankSoundEffect.GetCue("Collision 2"); _completeDead = _soundBankSoundEffect.GetCue("Complete-Dead"); _explosion1 = _soundBankSoundEffect.GetCue("Explosion 1"); _hit = _soundBankSoundEffect.GetCue("Hit"); _marioCoin = _soundBankSoundEffect.GetCue("Mario Coin"); _randomMelody1 = _soundBankSoundEffect.GetCue("Random Melody 1"); _randomMelody2 = _soundBankSoundEffect.GetCue("Random Melody 2"); _sfx1 = _soundBankSoundEffect.GetCue("SFX1"); _thumbMove1 = _soundBankSoundEffect.GetCue("ThumbMove 1"); MusicVolume = 0.5f; MusicPitch = 0.5f; _audioEngine.GetCategory("Music").SetVolume(_musicVolume); _currentSong.SetVariable("Pitch", _musicPitch); }
/// <summary> /// Create sound. /// </summary> static Sound() { try { string dir = Directories.SoundsDirectory; audioEngine = new AudioEngine( Path.Combine(dir, "SpeedyRacer.xgs")); waveBank = new WaveBank(audioEngine, Path.Combine(dir, "Wave Bank.xwb")); // Dummy wavebank call to get rid of the warning that waveBank is // never used (well it is used, but only inside of XNA). if (waveBank != null) soundBank = new SoundBank(audioEngine, Path.Combine(dir, "Sound Bank.xsb")); // Get the gears category to change volume and pitching of gear sounds. gearsCategory = audioEngine.GetCategory("Gears"); } // try catch (Exception ex) { Log.Write("Failed to create sound class: " + ex.ToString()); } // catch }
//////////////////////////////////////////////////////////////////////////////// protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); title_sprite = Content.Load<Texture2D> ("images/title_trans"); title_yellow = Content.Load<Texture2D> ("images/title_yellow"); title_green = Content.Load<Texture2D> ("images/title_green"); title_blue = Content.Load<Texture2D> ("images/title_blue"); title_red = Content.Load<Texture2D> ("images/title_red"); title_orange = Content.Load<Texture2D> ("images/title_orange"); menu_new_sprite = Content.Load<Texture2D> ("images/menu_newgame"); menu_instruct_sprite = Content.Load<Texture2D> ("images/menu_instruct"); menu_exit_sprite = Content.Load<Texture2D> ("images/menu_exit"); menu_resume_sprite = Content.Load<Texture2D> ("images/menu_resume"); ng_sprite = Content.Load<Texture2D> ("images/ng"); menu_credits_sprite = Content.Load<Texture2D> ("images/credits_sprite2"); bg1 = Content.Load<Texture2D> ("images/bg1c"); bg2 = Content.Load<Texture2D> ("images/bg2"); bg3 = Content.Load<Texture2D> ("images/bg3"); bg4 = Content.Load<Texture2D> ("images/bg4"); bg5 = Content.Load<Texture2D> ("images/bg5"); bg6 = Content.Load<Texture2D> ("images/bg6"); instructions1 = Content.Load<Texture2D> ("images/instructions1"); instructions2 = Content.Load<Texture2D> ("images/instructions2"); //instructions_blur = Content.Load<Texture2D> ("images/instructions_blur"); credits_screen = Content.Load<Texture2D> ("images/credits7"); chart_sprite = Content.Load<Texture2D> ("images/Chart1"); chart_stuff_sprite = Content.Load<Texture2D> ("images/Chart2"); wall_sprite = Content.Load<Texture2D> ("images/Walls"); conveyor_sprite = Content.Load<Texture2D> ("images/Conveyor"); grabber_sprite = Content.Load<Texture2D> ("images/Grabber"); lightning_sprite = Content.Load<Texture2D> ("images/Lightning"); frame_sprite = Content.Load<Texture2D> ("images/Frame3"); block_sprite = Content.Load<Texture2D> ("images/Blocks"); big_purple_sprite = Content.Load<Texture2D> ("images/bigpurple"); rainbow_sprite = Content.Load<Texture2D> ("images/Rainbow"); box_sprite = Content.Load<Texture2D> ("images/Box2"); box_newgame_sprite = Content.Load<Texture2D> ("images/box_newgame"); box_difficulty_sprite = Content.Load<Texture2D> ("images/box_difficulty"); box_menu_sprite = Content.Load<Texture2D> ("images/box_menu"); box_sound_sprite = Content.Load<Texture2D> ("images/box_sound"); box_on_sprite = Content.Load<Texture2D> ("images/box_on"); box_off_sprite = Content.Load<Texture2D> ("images/box_off"); box_music_sprite = Content.Load<Texture2D> ("images/box_music"); box_on2_sprite = Content.Load<Texture2D> ("images/box_on2"); box_off2_sprite = Content.Load<Texture2D> ("images/box_off2"); box_1_sprite = Content.Load<Texture2D> ("images/box_1"); box_2_sprite = Content.Load<Texture2D> ("images/box_2"); box_3_sprite = Content.Load<Texture2D> ("images/box_3"); box_4_sprite = Content.Load<Texture2D> ("images/box_4"); box_5_sprite = Content.Load<Texture2D> ("images/box_5"); box_6_sprite = Content.Load<Texture2D> ("images/box_6"); box_7_sprite = Content.Load<Texture2D> ("images/box_7"); box_8_sprite = Content.Load<Texture2D> ("images/box_8"); box_9_sprite = Content.Load<Texture2D> ("images/box_9"); box_10_sprite = Content.Load<Texture2D> ("images/box_10"); box_height_sprite = Content.Load<Texture2D> ("images/box_height"); box_exit_sprite = Content.Load<Texture2D> ("images/box_exit"); box_timer_sprite = Content.Load<Texture2D> ("images/box_timer"); timer_0_sprite = Content.Load<Texture2D> ("images/timer_0"); timer_1_sprite = Content.Load<Texture2D> ("images/timer_1"); timer_2_sprite = Content.Load<Texture2D> ("images/timer_2"); timer_3_sprite = Content.Load<Texture2D> ("images/timer_3"); timer_4_sprite = Content.Load<Texture2D> ("images/timer_4"); timer_5_sprite = Content.Load<Texture2D> ("images/timer_5"); timer_6_sprite = Content.Load<Texture2D> ("images/timer_6"); timer_7_sprite = Content.Load<Texture2D> ("images/timer_7"); timer_8_sprite = Content.Load<Texture2D> ("images/timer_8"); timer_9_sprite = Content.Load<Texture2D> ("images/timer_9"); counter_0_sprite = Content.Load<Texture2D> ("images/counter_0"); counter_1_sprite = Content.Load<Texture2D> ("images/counter_1"); counter_2_sprite = Content.Load<Texture2D> ("images/counter_2"); counter_3_sprite = Content.Load<Texture2D> ("images/counter_3"); counter_4_sprite = Content.Load<Texture2D> ("images/counter_4"); counter_5_sprite = Content.Load<Texture2D> ("images/counter_5"); counter_6_sprite = Content.Load<Texture2D> ("images/counter_6"); counter_7_sprite = Content.Load<Texture2D> ("images/counter_7"); counter_8_sprite = Content.Load<Texture2D> ("images/counter_8"); counter_9_sprite = Content.Load<Texture2D> ("images/counter_9"); counter_label = Content.Load<Texture2D> ("images/blocksleft3"); blockhead_logo_sprite = Content.Load<Texture2D> ("images/blockhead3"); youwin_sprite = Content.Load<Texture2D> ("images/youwin"); youlose_sprite = Content.Load<Texture2D> ("images/youlose"); particle_red = Content.Load<Texture2D> ("images/particle_red"); particle_orange = Content.Load<Texture2D> ("images/particle_orange"); particle_yellow = Content.Load<Texture2D> ("images/particle_yellow"); particle_green = Content.Load<Texture2D> ("images/particle_green"); particle_blue = Content.Load<Texture2D> ("images/particle_blue"); particle_purple = Content.Load<Texture2D> ("images/particle_purple"); particle_white = Content.Load<Texture2D> ("images/particle_white"); particle_grey = Content.Load<Texture2D> ("images/particle_grey"); particle_black = Content.Load<Texture2D> ("images/particle_black"); particle_smoke_sprite = Content.Load<Texture2D> ("images/particle_smoke"); solid_black = Content.Load<Texture2D> ("images/solid_black"); solid_white = Content.Load<Texture2D> ("images/solid_white"); solid_red = Content.Load<Texture2D> ("images/solid_red"); solid_orange = Content.Load<Texture2D> ("images/solid_orange"); solid_yellow = Content.Load<Texture2D> ("images/solid_yellow"); solid_green = Content.Load<Texture2D> ("images/solid_green"); solid_blue = Content.Load<Texture2D> ("images/solid_blue"); solid_purple = Content.Load<Texture2D> ("images/solid_purple"); color_flash_sprite = Content.Load<Texture2D> ("images/solid_white"); splash_sprite = Content.Load<Texture2D> ("images/splash2"); intro_lightning1_sprite = Content.Load<Texture2D> ("images/lightning1a"); intro_lightning2_sprite = Content.Load<Texture2D> ("images/lightning2"); intro_lightning3_sprite = Content.Load<Texture2D> ("images/lightning3"); credits_hypno = Content.Load<Texture2D> ("images/hypno3"); demolition_sprite = Content.Load<Texture2D> ("images/demolition1c"); title_bg_sprite = title_green; debug_font = Content.Load<SpriteFont>("Kooten"); audioEngine = new AudioEngine("Content/blockhead_sound.xgs"); waveBank = new WaveBank(audioEngine, "Content/Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content/Sound Bank.xsb"); sound_category = audioEngine.GetCategory("Default"); music_category = audioEngine.GetCategory("Music"); sound_category.SetVolume(sound_volume); music_category.SetVolume(music_volume); }
public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); audioEngine = new AudioEngine("Content\\soundProject.xgs"); waveBankSFX = new WaveBank(audioEngine, "Content\\SFX.xwb"); waveBankBGM = new WaveBank(audioEngine, "Content\\BGM.xwb", 0, 4); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); audioEngine.Update(); defaultCategory = audioEngine.GetCategory("Default"); defaultCategory.SetVolume(OptionsMenuScreen.sfxVolume / 10); }
protected override void LoadContent() { audioEngine = new AudioEngine("Content\\Audio\\Audio.xgs"); waveBank = new WaveBank(audioEngine, "Content\\Audio\\myWaveBank.xwb"); soundBank = new SoundBank(audioEngine, "Content\\Audio\\mySoundBank.xsb"); musicCategory = audioEngine.GetCategory("Music"); defaultCategory = audioEngine.GetCategory("Default"); for (int i = 0; i < cueArray.Length; i++) { cueArray[i] = soundBank.GetCue("engine"); cueArray[i].Apply3D(listener_, CarSoundEmitters.AudioEmitters[i]); cueArray[i].Play(); } base.LoadContent(); }
//+++++++++++++++++++++++ INITIALIZE +++++++++++++++++ /// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { rnd = new Random(); texto = ""; currMouseState = Mouse.GetState(); lastMouseState = Mouse.GetState(); fondo = false; completoDelTo = false; tiempoFin = 0; collisionOffSet = Point.Zero; tiempoLluvia = 0; colisiond = 0; colisioni = 0; parada = 0; alturaTerreno = 4; jumpTimer = -10f; tiempoVelocidadSalto = 0; mundo1 = new Mundo(2.2f); currentDisparoState = DisparoState.Quieto; currentGravedadState = GravedadState.Aire; borrarBala = false; spriteList = new List<AutomatedSprite>(); disparoList = new List<Disparo>(); lluviaList = new List<Disparo>(); mapaList = new List<Mapa>(); terrenoList = new List<Mapa>(); terrenoList2 = new List<Mapa>(); terrenoListSuelo = new List<Mapa>(); fondoList1 = new List<Mapa>(); fondoList2 = new List<Mapa>(); map = new List<Point>(); jefeList = new List<Jefe>(); vidaList = new List<Mapa>(); vidaList2 = new List<Mapa>(); tigres = new List<Mapa>(); maxPosBloque = 0f; terrenoTiempoPasado = 0; terrenoDireccion = 0; terrenoTiempo = 100; arrastre = 0; //Variables jefe respawnJefeMin = 0; respawnJefeMax = 1; //Posiciones posicionTerrenoX = 0; posicionTerrenoY = 700; posicionFondo1 = -1000; posicionFondo2 = -1000; //Disparo delayDisparo = 200; delayDisparoCurrent = 900; currentParteMapa = ParteMapa.Suelo; numFondo1 = 0; numFondo2 = 0; numTerreno1 = 0; capaTerreno = 0.5f; //Muerte caido = false; puntosControl = new List<float>(); puntoControl = 0; vidaPos = 0; tiempoHerido = 500f; tiempoMuerto = 0; muertoDelTo = false; for (int n = 0; n < 200; n++) map.Add(new Point(2, 0)); complete = new Mapa( Game.Content.Load<Texture2D>(@"Images/LevelComplete"), new Vector2(120, 120), new Point(1140, 496), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f); vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos += 7; for (int i = 0; i < 28; i++) { vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(1, 0), new Point(1, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos += 7; } vidaList.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(2, 0), new Point(2, 0), new Vector2(0f, 0), 0f, 1000, 0.89f)); vidaPos = 0; vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(0, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; for (int i = 0; i < 28; i++) { vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(1, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; } vidaList2.Add(new Mapa( Game.Content.Load<Texture2D>(@"Images/vidaSprite"), new Vector2(50 + vidaPos, 30), new Point(10, 23), new Point(0, 0), new Point(2, 1), new Point(0, 0), new Vector2(0f, 0), 0f, 1000, 0.99f)); vidaPos += 7; player = new UserControlledSprite( Game.Content.Load<Texture2D>(@"Images/pj"), new Vector2((1366 / 2) - 152, 164), new Point(194, 178), new Point(collisionOffSet.X, collisionOffSet.Y), new Point(0, 0), new Point(0, 0), new Vector2(0f, 0), 0f, 70, 0.80f, 30); pointer = new StaticSprite( Game.Content.Load<Texture2D>(@"Images/cursor"), new Vector2(0, 0), new Point(24, 28), new Point(5, 5), new Point(0, 0), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.9f); spriteBatch = new SpriteBatch(Game.GraphicsDevice); audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb"); waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb"); soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb"); musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb"); musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb"); ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb"); ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb"); musicCategory = audioEngine.GetCategory("Default"); musicCategory.SetVolume(0); reproducirMusica("ingame"); reproducirAmbiente("viento"); trackCue = soundBank.GetCue("caido"); Suelo(-100, posicionTerrenoY, 0, -600, terrenoList, 0.540f); SueloGrande(0, posicionTerrenoY, 0, 400, terrenoList, 0.530f); PuntoControlTigre(1366 / 2 - 15, posicionTerrenoY); puntosControl.Add(-(1366 / 2 - 15)); Suelo(posicionTerrenoX, posicionTerrenoY, 860, -120, terrenoList, 0.541f); texto = "Posicion escaleras X" + posicionTerrenoX + "Posicion escaleras Y" + posicionTerrenoY; Escaleras2(posicionTerrenoX-1000, posicionTerrenoY - 200, 500, 0, 9, terrenoList2, 0.300f, true); Suelo(posicionTerrenoX, posicionTerrenoY+300, 4500, -120, terrenoList, 0.542f); PuntoControlTigre(posicionTerrenoX + 350, posicionTerrenoY - tigres[0].getFrameSize.Y + 30); puntosControl.Add(-posicionTerrenoX + 350); Suelo(posicionTerrenoX, posicionTerrenoY+300, 1000, -120, terrenoList, 0.542f); PuntoControlTigre(posicionTerrenoX + 350, posicionTerrenoY - tigres[0].getFrameSize.Y + 30); puntosControl.Add(-posicionTerrenoX + 350); SueloChico(posicionTerrenoX, posicionTerrenoY, 800, -50, 0, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 4, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 3, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 3, terrenoList, 0.543f); Suelo(posicionTerrenoX + 700, posicionTerrenoY + 100, 0, 0, terrenoList, 0.543f); Escaleras(posicionTerrenoX +700, posicionTerrenoY + 200, 100, 50, 9, terrenoList, 0.543f, true); Suelo(posicionTerrenoX + 700, posicionTerrenoY + 200, 0, 0, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f); Suelo(posicionTerrenoX + 200, posicionTerrenoY +50, 0, 0, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f); Suelo(posicionTerrenoX + 200, posicionTerrenoY + 50, 0, 0, terrenoList, 0.543f); SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f); Suelo(posicionTerrenoX + 200, posicionTerrenoY + 50, 0, 0, terrenoList, 0.543f); Escaleras(posicionTerrenoX + 2800, posicionTerrenoY, 100, 10, 20, terrenoList, 0.543f, false); final = new Mapa( Game.Content.Load<Texture2D>(@"Images/final"), new Vector2(posicionTerrenoX + 200, posicionTerrenoY - 146), new Point(171, 156), new Point(0, 0), new Point(0, 1), new Point(4, 3), new Vector2(0f, 0), 0f, 200, 0.9f); posicionTerrenoX = 0; posicionTerrenoY = 0; Suelo(posicionTerrenoX+6500, posicionTerrenoY+300, 0, 0, terrenoList2, 0.302f); Escaleras(posicionTerrenoX + 3000, posicionTerrenoY + 200, 100, 30, 15, terrenoList2, 0.302f, true); foreach (Sprite s in terrenoList2) { s.getEscala = 0.8f; s.GetCollisionOffSet = new Point(60, 60); } puntuacionFuente = Game.Content.Load<SpriteFont>(@"Fuentes\fuente"); player.setTamAura = 300; foreach (Sprite s in jefeList) s.setTamAura = 400; //base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { botones = new List<Boton>(); seleccionados = new List<Boton>(); seguros = new List<Boton>(); posicionFrameY = new int[4]; tamFrameX = new int[4]; tamFrameY = new int[4]; posicionFrameYs = new int[4]; tamFrameXs = new int[4]; tamFrameYs = new int[4]; pulsados = new Boolean[4]; posicionBotonY = 276; posicionBotonX = 730; posicionSeleccionado = 720; direccion = 0; velocidad = 50; idBoton = 0; mostrarSeguro = false; posicionFrameY[0] = 1346; posicionFrameY[1] = 1375; posicionFrameY[2] = 1407; posicionFrameY[3] = 1443; tamFrameX[0] = 164; tamFrameX[1] = 234; tamFrameX[2] = 77; tamFrameX[3] = 177; tamFrameY[0] = 29; tamFrameY[1] = 31; tamFrameY[2] = 30; tamFrameY[3] = 35; posicionFrameYs[0] = 901; posicionFrameYs[1] = 991; posicionFrameYs[2] = 1125; posicionFrameYs[3] = 1254; tamFrameXs[0] = 504; tamFrameXs[1] = 434; tamFrameXs[2] = 543; tamFrameXs[3] = 202; tamFrameYs[0] = 90; tamFrameYs[1] = 134; tamFrameYs[2] = 129; tamFrameYs[3] = 92; menu = new Mapa( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(0, 0), new Point(1366, 768), new Point(0, 0), new Point(0, 0), new Point(0, 0), Vector2.Zero, 0f, 1000, 0f); pointer = new StaticSprite( Game.Content.Load<Texture2D>(@"Images/cursor"), new Vector2(0, 0), new Point(24, 28), new Point(5, 5), new Point(0, 0), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.9f); for (int i = 0; i < 4; i++) { botones.Add(new Boton( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(1000, posicionBotonY), new Point(tamFrameX[i], tamFrameY[i]), new Point(0, posicionFrameY[i]), new Point(0, posicionFrameY[i]), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.1f) ); posicionBotonY += tamFrameY[i] + 30; } for (int i = 0; i < 4; i++) { seleccionados.Add(new Boton( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(posicionBotonX, 85), new Point(tamFrameXs[i], tamFrameYs[i]), new Point(0, posicionFrameYs[i]), new Point(0, posicionFrameYs[i]), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.1f) ); posicionBotonX += tamFrameXs[i] + 300; } seguros.Add(new Boton( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(525, 380), new Point(33,33), new Point(0,0), new Point(0, 1687), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.89f) ); seguros.Add(new Boton( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(675, 380), new Point(51, 33), new Point(0, 0), new Point(0, 1720), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.89f) ); seguros.Add(new Boton( Game.Content.Load<Texture2D>(@"Images/menuSprite"), new Vector2(450, 250), new Point(350, 210), new Point(0, 0), new Point(0, 1478), new Point(0, 0), Vector2.Zero, 0f, 1000, 0.89f) ); // TODO: Add your initialization code here spriteBatch = new SpriteBatch(Game.GraphicsDevice); audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb"); musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb"); musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb"); musicCategory = audioEngine.GetCategory("Default"); reproducirMusica("menu"); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { //// use a fixed frame rate of 30 frames per second //IsFixedTimeStep = true; //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 33); // run at full speed IsFixedTimeStep = false; // set screen size InitScreen(); // initialize our sound objects m_audio = new AudioEngine(@"Content\example.xgs"); m_wave = new WaveBank(m_audio, @"Content\example.xwb"); m_sound = new SoundBank(m_audio, @"Content\example.xsb"); // get a reference to our two sound categories m_catMusic = m_audio.GetCategory("Music"); m_catDefault = m_audio.GetCategory("Default"); // get a reference to Zoe's story m_story = m_sound.GetCue("zoe"); // start playing our background music m_sound.PlayCue("ensalada"); base.Initialize(); }