protected override void LoadContent() { _gamePlaySong = Content.Load <Song>("Sounds\\battle"); _menuSong = Content.Load <Song>("Sounds\\menu_song2"); _dead = Content.Load <Song>("Sounds\\defeat"); MediaPlayer.IsRepeating = true; MediaPlayer.Play(_menuSong); _menuClickSelected = Content.Load <SoundEffect>("Sounds\\button-25"); _spriteBatch = new SpriteBatch(GraphicsDevice); _gameIsOn = false; SetScreenSize(); _gameOverScreen = new GameOverScreen(this, _spriteBatch, Content.Load <SpriteFont>("menufont"), Content.Load <Texture2D>("gameover_screen")); Components.Add(_gameOverScreen); _gameOverScreen.Hide(); _startScreen = new StartScreen(this, _spriteBatch, Content.Load <SpriteFont>("menufont"), Content.Load <Texture2D>("splash_screen")); Components.Add(_startScreen); _startScreen.Hide(); _actionScreen = new ActionScreen(this, _spriteBatch, Content.Load <Texture2D>("Levels\\level1_background")); Components.Add(_actionScreen); _actionScreen.Hide(); //_activeScreen = _gameOverScreen; //_gameOverScreen.SetScoreText(); _activeScreen = _startScreen; _activeScreen.Show(); }
/// <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); // Menu _startScreen = new StartScreen(this, _spriteBatch, Content.Load <SpriteFont>("Fonts/gameFont"), Content.Load <Texture2D>("Background/startScreen")); Components.Add(_startScreen); _startScreen.Hide(); _actionScreen = new ActionScreen(this, _spriteBatch, Content.Load <Texture2D>("Background/spaceBackground")); Components.Add(_actionScreen); _actionScreen.Hide(); _activeScreen = _startScreen; _activeScreen.Show(); // Load _player Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load <Texture2D>("Animation/Space Unicorn"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 166, 100, 1, 5, Color.White, 1f, true); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.Width / 4, GraphicsDevice.Viewport.Height / 2); _player.Initialize(playerAnimation, playerPosition); // Load enemy _enemyTexture = Content.Load <Texture2D>("Animation/enemy"); // Load background _bgLayer1.Initialize(Content, "Background/spaceBackground", GraphicsDevice.Viewport.Width, -1); // Load _marshmallows _marshmallowIcon = Content.Load <Texture2D>("Animation/marshmallowLaser"); // Load music _gameMusic = Content.Load <Song>("Music/Space Unicorn"); // Load explosion _explosionTexture = Content.Load <Texture2D>("Animation/explosion"); // Load _font _font = Content.Load <SpriteFont>("Fonts/gameFont"); // Load powers _healthBoostIcon = Content.Load <Texture2D>("Powers/healthPowerUp"); _speedIcon = Content.Load <Texture2D>("Powers/speedIncrease"); _hyperSpaceIcon = Content.Load <Texture2D>("Powers/hyperSpace"); _saviorIcon = Content.Load <Texture2D>("Powers/bomb"); _addFairyIcon = Content.Load <Texture2D>("Powers/addFairy"); // Play music PlayMusic(_gameMusic); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); spriteFont = Content.Load <SpriteFont>("font"); formFont = Content.Load <SpriteFont>("FormFont"); popUpTexture = Content.Load <Texture2D>("quitscreen"); actionScreentexture = Content.Load <Texture2D>("greenmetal"); blankBlackTexture = Content.Load <Texture2D>("black"); //initialize and start the screens startScreen = new StartScreen(this, spriteBatch, formFont); Components.Add(startScreen); startScreen.ButtonClicked += new StartScreen.ClickEvent(HandleStartScreenButtons); startScreen.Hide(); networkScreen = new NetworkGameSelectScreen(this, spriteBatch, spriteFont, blankBlackTexture); Components.Add(networkScreen); networkScreen.ButtonClicked += new NetworkGameSelectScreen.ClickEvent(HandleNetworkSelectScreenButtons); networkScreen.Hide(); joinGameScreen = new JoinNetworkGameScreen(this, spriteBatch, formFont, blankBlackTexture); Components.Add(joinGameScreen); joinGameScreen.ButtonClicked += new JoinNetworkGameScreen.ClickEvent(HandleJoinGameScreenButtons); joinGameScreen.Hide(); hostGameScreen = new HostNetworkGameScreen(this, spriteBatch, formFont, blankBlackTexture); Components.Add(hostGameScreen); hostGameScreen.ButtonClicked += new HostNetworkGameScreen.ClickEvent(HandleHostGameScreenButtons); hostGameScreen.Hide(); actionScreen = new ActionScreen(this, spriteBatch, actionScreentexture); Components.Add(actionScreen); actionScreen.Hide(); popUpScreen = new PopUpScreen(this, spriteBatch, spriteFont, popUpTexture); Components.Add(popUpScreen); popUpScreen.Hide(); activeScreen = startScreen; //activeScreen = joinGameScreen; activeScreen.Show(); IsMouseVisible = true; }
private void HandlePopUpScreen() { if (CheckKey(Keys.Enter)) { if (popUpScreen.SelectedIndex == 0) { activeScreen.Hide(); actionScreen.Hide(); activeScreen = startScreen; activeScreen.Show(); } if (popUpScreen.SelectedIndex == 1) { activeScreen.Hide(); activeScreen = actionScreen; activeScreen.Show(); } } }