protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _laserSound = Content.Load <SoundEffect>("playershoot"); _explosionSound = Content.Load <SoundEffect>("Sounds/explosion"); _enemyLaserSound = Content.Load <SoundEffect>("Sounds/enemylaser"); _greenShot = Content.Load <Texture2D>("laserGreen"); _greenExplosion = Content.Load <Texture2D>("explosion"); _redExplosion = Content.Load <Texture2D>("explosion"); _redShot = Content.Load <Texture2D>("laserRed"); _life = Content.Load <Texture2D>("player_2"); _enemyShip = Content.Load <Texture2D>("Scorpion ship"); _enemyUfo = Content.Load <Texture2D>("enemy sprite"); _defaultFont = Content.Load <SpriteFont>("DefaultFont"); _smallFont = Content.Load <SpriteFont>("smallFont"); _background = CreateBackground(); _mineController = new MineController(this, graphics, spriteBatch, 500, 1000); Components.Add(_mineController); }
void NewGame() { Components.Clear(); _enemies.Clear(); _livesLeft = 3; _wave = 0; _spaceship = new PlayerSpaceShip(this, Content.Load <Texture2D>("Player ship"), Content.Load <Texture2D>("Player ship"), Content.Load <Texture2D>("Player ship"), Content.Load <Texture2D>("shield"), new Vector2(WindowSize.X / 2, WindowSize.Y - 50), spriteBatch); Components.Add(_spaceship); _borderOverSpaceship = _halfScreenHeight - _spaceship.Texture.Height; _mineController = new MineController(this, graphics, spriteBatch, 3000, 9000); Components.Add(_mineController); _textController = new TextController(this, graphics, spriteBatch, Color.LightGreen, _defaultFont, "10 points", "25 points", "100 points", "500 points"); Components.Add(_textController); }