/// <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); backgroundPlay = Content.Load <Texture2D>("background_play"); backgroundMenu = Content.Load <Texture2D>("background_menu"); Texture2D paletteSprite = Content.Load <Texture2D>("palette"); palette = new Palette(paletteSprite, screenBound); Texture2D briqueSprite = Content.Load <Texture2D>("brique"); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.LimeGreen, new Vector2(i, 100 + briqueSprite.Height), 1)); } for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.Fuchsia, new Vector2(i, 100), 1)); } for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.Orange, new Vector2(i, 100 - briqueSprite.Height), 1)); } for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.DodgerBlue, new Vector2(i, 100 - 2 * briqueSprite.Height), 2)); } for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.DarkOrchid, new Vector2(i, 100 - 3 * briqueSprite.Height), 1)); } for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) { briques.Add(new Brique(briqueSprite, Color.DeepPink, new Vector2(i, 100 - 4 * briqueSprite.Height), 1)); } Texture2D balleSprite = Content.Load <Texture2D>("balle"); balle = new Balle(balleSprite, screenBound, new Vector2(screenBound.Width / 2 - (balleSprite.Width), screenBound.Height - 70), new Vector2(0, 1), false); Texture2D boutonStartSprite = Content.Load <Texture2D>("boutonStart"); Texture2D boutonStartHighlighted = Content.Load <Texture2D>("boutonStart_highlighted"); Texture2D boutonStartActivated = Content.Load <Texture2D>("boutonStart_activated"); boutonStart = new Bouton(boutonStartSprite, boutonStartHighlighted, boutonStartActivated, (screenBound.Width / 4) - (boutonStartSprite.Width / 2), screenBound.Height - 100); boutonStart.Clicked += (s, e) => gameState = GameState.Loading; Texture2D boutonExitSprite = Content.Load <Texture2D>("boutonExit"); Texture2D boutonExitHigh = Content.Load <Texture2D>("boutonExit_highlighted"); Texture2D boutonExitAct = Content.Load <Texture2D>("boutonExit_Activated"); boutonExit = new Bouton(boutonExitSprite, boutonExitHigh, boutonExitAct, 3 * (screenBound.Width / 4) - (boutonStartSprite.Width / 2), screenBound.Height - 100); boutonExit.Clicked += (s, e) => Exit(); Texture2D boutonResumeSprite = Content.Load <Texture2D>("boutonResume"); Texture2D boutonResumeHigh = Content.Load <Texture2D>("boutonResume_Highlighted"); Texture2D boutonResumeAct = Content.Load <Texture2D>("boutonResume_Activated"); boutonResume = new Bouton(boutonResumeSprite, boutonResumeHigh, boutonResumeAct, screenBound.Width / 2 - boutonResumeSprite.Width / 2, screenBound.Height / 2 - boutonResumeSprite.Height / 2); boutonResume.Clicked += (s, e) => gameState = GameState.Loading; Texture2D chiffre3Sprite = Content.Load <Texture2D>("3"); chiffre = new WaitTime(chiffre3Sprite, screenBound); balleAnim = new Balle(balleSprite, screenBound, new Vector2(screenBound.Width / 2 - (balleSprite.Width), screenBound.Height - 150), new Vector2(r.Next(1, 10), r.Next(-10, -1)), true); balleAnim2 = new Balle(balleSprite, screenBound, new Vector2(screenBound.Width / 2 - 3 * (balleSprite.Width), screenBound.Height - 150), new Vector2(r.Next(1, 10), r.Next(-10, -1)), true); lives = 3; Texture2D heartSprite = Content.Load <Texture2D>("heart"); for (int i = 0; i < lives * (heartSprite.Width + 5); i += heartSprite.Width + 5) { hearts.Add(new Heart(heartSprite, new Vector2(i + 5, screenBound.Height - 30))); } balleMur = Content.Load <SoundEffect>("HitWall"); ballePalette = Content.Load <SoundEffect>("HitPalette"); explosionBrique = Content.Load <SoundEffect>("Explosion"); death = Content.Load <SoundEffect>("Death"); deathFinal = Content.Load <SoundEffect>("DeathFinal"); countdown = Content.Load <SoundEffect>("321"); mainMenuMusic = Content.Load <Song>("mainMenuMusic"); gameMusic = Content.Load <Song>("gameMusic"); }
/// <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); backgroundPlay = Content.Load<Texture2D>("background_play"); backgroundMenu = Content.Load<Texture2D>("background_menu"); Texture2D paletteSprite = Content.Load<Texture2D>("palette"); palette = new Palette(paletteSprite, screenBound); Texture2D briqueSprite = Content.Load<Texture2D>("brique"); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.LimeGreen, new Vector2(i, 100 + briqueSprite.Height), 1)); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.Fuchsia, new Vector2(i, 100), 1)); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.Orange, new Vector2(i, 100 - briqueSprite.Height), 1)); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.DodgerBlue, new Vector2(i, 100 - 2*briqueSprite.Height), 2)); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.DarkOrchid, new Vector2(i, 100 - 3*briqueSprite.Height), 1)); for (int i = 0; i < screenBound.Width; i += briqueSprite.Width) briques.Add(new Brique(briqueSprite, Color.DeepPink, new Vector2(i, 100 - 4*briqueSprite.Height), 1)); Texture2D balleSprite = Content.Load<Texture2D>("balle"); balle = new Balle(balleSprite, screenBound, new Vector2(screenBound.Width / 2 - (balleSprite.Width), screenBound.Height - 70)); Texture2D boutonStartSprite = Content.Load<Texture2D>("boutonStart"); Texture2D boutonStartHighlighted = Content.Load<Texture2D>("boutonStart_highlighted"); Texture2D boutonStartActivated = Content.Load<Texture2D>("boutonStart_activated"); boutonStart = new Bouton(boutonStartSprite, boutonStartHighlighted, boutonStartActivated, (screenBound.Width / 4) - (boutonStartSprite.Width / 2), screenBound.Height - 100); boutonStart.Clicked += (s, e) => gameState = GameState.Loading; Texture2D boutonExitSprite = Content.Load<Texture2D>("boutonExit"); Texture2D boutonExitHigh = Content.Load<Texture2D>("boutonExit_highlighted"); Texture2D boutonExitAct = Content.Load<Texture2D>("boutonExit_Activated"); boutonExit = new Bouton(boutonExitSprite, boutonExitHigh, boutonExitAct, 3*(screenBound.Width / 4) - (boutonStartSprite.Width / 2), screenBound.Height - 100); boutonExit.Clicked += (s, e) => Exit(); Texture2D boutonResumeSprite = Content.Load<Texture2D>("boutonResume"); Texture2D boutonResumeHigh = Content.Load<Texture2D>("boutonResume_Highlighted"); Texture2D boutonResumeAct = Content.Load<Texture2D>("boutonResume_Activated"); boutonResume = new Bouton(boutonResumeSprite, boutonResumeHigh, boutonResumeAct, screenBound.Width/2 - boutonResumeSprite.Width/2, screenBound.Height/2 - boutonResumeSprite.Height/2); boutonResume.Clicked += (s, e) => gameState = GameState.Loading; Texture2D chiffre3Sprite = Content.Load<Texture2D>("3"); chiffre = new WaitTime(chiffre3Sprite, screenBound); lives = 3; balleMur = Content.Load<SoundEffect>("HitWall"); ballePalette = Content.Load<SoundEffect>("HitPalette"); explosionBrique = Content.Load<SoundEffect>("Explosion"); death = Content.Load<SoundEffect>("Death"); deathFinal = Content.Load<SoundEffect>("DeathFinal"); countdown = Content.Load<SoundEffect>("321"); mainMenuMusic = Content.Load<Song>("mainMenuMusic"); gameMusic = Content.Load<Song>("gameMusic"); }