public void LevelUp(int oldRound, int lives) { //moves to the next level when the procedure is called switch (oldRound) { case -1: Components.Clear(); blnGameOver = true; break; case 0: levelRocks = new LevelRocks(this, lives); Components.Add(levelRocks); Components.Remove(baseLevel); baseLevel = null; break; case 1: levelShooter = new LevelShooter(this, lives); Components.Add(levelShooter); Components.Remove(levelRocks); levelRocks = null; break; } }
/// <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() { // TODO: Add your initialization logic here //seed random gen. and start the BaseLevelShips rnd = new Random(); baseLevel = new BaseLevelShips(this); Components.Add(baseLevel); base.Initialize(); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } // TODO: Add your update logic here //If the user presses enter, if (blnGameOver) { if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { baseLevel = new BaseLevelShips(this); Components.Add(baseLevel); blnGameOver = false; } } base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update logic here //If the user presses enter, if (blnGameOver) { if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { baseLevel = new BaseLevelShips(this); Components.Add(baseLevel); blnGameOver = false; } } base.Update(gameTime); }