示例#1
0
        /// <summary>
        /// Called 60 frames/per second and Draw all the
        /// sprites and other drawable images here
        /// </summary>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.LawnGreen);

            spriteBatch.Begin();

            spriteBatch.Draw(backgroundImage, Vector2.Zero, Color.White);

            if (gameState == GameStates.Running)
            {
                restartButton.Draw(spriteBatch);

                // Draw asteroids game

                shipSprite.Draw(spriteBatch);
                asteroidController.Draw(spriteBatch);


                // Draw Chase game


                DrawGameStatus(spriteBatch);
                DrawGameFooter(spriteBatch);
            }
            else
            {
                if (gameState == GameStates.Won)
                {
                    spriteBatch.DrawString(arialFont, "You have Won!", new Vector2(200, 600), Color.White);
                }
                else if (gameState == GameStates.Lost)
                {
                    spriteBatch.DrawString(arialFont, "You have Lost!", new Vector2(200, 600), Color.White);
                }
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }
示例#2
0
        /// <summary>
        /// Called 60 frames/per second and Draw all the
        /// sprites and other drawable images here
        /// </summary>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.LawnGreen);

            spriteBatch.Begin();


            spriteBatch.Draw(backgroundImage, Vector2.Zero, Color.White);

            // Draw asteroids game

            shipSprite.Draw(spriteBatch);
            asteroidController.Draw(spriteBatch);

            // Draw Chase game

            coinsController.Draw(spriteBatch);

            DrawGameStatus(spriteBatch);


            DrawGameFooter(spriteBatch);

            if (state == GameStates.lost)
            {
                DrawGameLost(spriteBatch);
            }

            if (state == GameStates.won)
            {
                DrawGameWon(spriteBatch);
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }