Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            _spriteBatch.Begin();

            player.Draw(_spriteBatch);

            foreach (GoldCoin gc in goldCoins)
            {
                gc.Draw(_spriteBatch);
            }

            foreach (Enemy e in enemies)
            {
                e.Draw(_spriteBatch);
            }
            printText.Print("Poäng: " + player.Points, _spriteBatch, 0, 0);

            _spriteBatch.End();
            base.Draw(gameTime);
        }
Пример #2
0
 protected override void Draw(GameTime gameTime)
 {
     _graphics.GraphicsDevice.Clear(background);
     if (gameStage == 0)
     {
         _spriteBatch.Begin();
         //_spriteBatch.Draw(planet, new Rectangle(0, 0, (int)SCREEN_WIDTH, (int)SCREEN_HEIGHT), Color.White);
         _spriteBatch.DrawString(font, "Awesome SpaceZooter Game", new Vector2(SCREEN_WIDTH / 2 - 275, SCREEN_HEIGHT / 2), Color.Black);
         _spriteBatch.DrawString(font, "tap to start game", new Vector2(SCREEN_WIDTH / 2 - 275, SCREEN_HEIGHT / 2 + 25), Color.Black);
         _spriteBatch.End();
     }
     if (gameStage == 1)
     {
         _spriteBatch.Begin();
         //_spriteBatch.Draw(planet, new Rectangle(0, 0, (int)SCREEN_WIDTH, (int)SCREEN_HEIGHT), Color.White);
         _spriteBatch.DrawString(font, "Combo: " + combo + "x", new Vector2(50, 50), Color.Black);
         _spriteBatch.DrawString(font, "Score: " + score, new Vector2(50, 75), Color.Black);
         if (combo > 15)
         {
             if (combo < 50)
             {
                 _spriteBatch.DrawString(font, "get combo over 50 to use THREE (3)  FREKIN cannons! ", new Vector2(SCREEN_WIDTH / 2 - 290, 25), Color.Black);
             }
             else
             {
                 _spriteBatch.DrawString(font, "AWESOME! KEEP IT UP, CHAMP!", new Vector2(SCREEN_WIDTH / 2 - 280, 25), Color.Black);
             }
         }
         else
         {
             _spriteBatch.DrawString(font, "get combo over 15 to use two (2) cannons ", new Vector2(SCREEN_WIDTH / 2 - 280, 25), Color.Black);
         }
         player.healthBar.Draw(_spriteBatch);
         if (!usingMouse)
         {
             //draw Joysticks
             joystick_right.Draw(_spriteBatch);
             joystick_left.Draw(_spriteBatch);
         }
         _spriteBatch.End();
     }
     if (gameStage == 2)
     {
         _spriteBatch.Begin();
         // _spriteBatch.Draw(planet, new Rectangle(0,0, (int)SCREEN_WIDTH, (int)SCREEN_HEIGHT), Color.White);
         _spriteBatch.DrawString(font, "Game Over, n00b!", new Vector2(SCREEN_WIDTH / 2 - 275, SCREEN_HEIGHT / 2), Color.Black);
         _spriteBatch.DrawString(font, "your pathetic score was " + score, new Vector2(SCREEN_WIDTH / 2 - 280, SCREEN_HEIGHT / 2 + 25), Color.Black);
         _spriteBatch.End();
     }
     player.Draw(_spriteBatch, font);
     //draw hearts
     if (heartList.Count > 0)
     {
         foreach (HeartPickup h in heartList)
         {
             h.Draw(this);
         }
     }
     //go and draw each enemy
     foreach (Enemy e in enemyList)
     {
         e.Draw();
     }
     foreach (Ufo u in ufoList)
     {
         u.Draw();
     }
     //draw particles in their own patch
     if (emitters.Count > 0)
     {
         foreach (ParticleEngine p in emitters)
         {
             p.Draw(_spriteBatch);
         }
     }
     foreach (Bullet b in bulletArray)
     {
         if (b != null)
         {
             b.Draw();
         }
     }
     base.Draw(gameTime);
 }