/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> /// This is called in the main loop after Update to render the current state of the game /// on the screen. protected override void Draw(GameTime gameTime) { // spriteBatch is an object that allows us to draw everything spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); // draw the background if we've started if (start) { spriteBatch.Draw(backGroundTexture, viewPort, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 1); //draw the aliens foreach (Alien a in aliens) { a.Draw(spriteBatch); } } //Draw start screen if start hasnt been pushed else if (!start) { spriteBatch.Draw(startScreenTexture, viewPort, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 1); } // draw the ship over background myShip.Draw(spriteBatch); //Draw the bombs Arsenal.Draw(spriteBatch); //Draw the missiles shipWeapons.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointWrap); _invadersWall.Draw(spriteBatch); _ship.Draw(); if (_bullet.IsVisible) { _bullet.Draw(spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }