Esempio n. 1
0
        public void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred,
                              null,
                              SamplerState.LinearWrap,
                              null, null, null,
                              camera.GetViewMatrix(Vector2.Zero));

            //Player
            spriteBatch.DrawString(Font, "PLAYER", new Vector2(40, 40), Color.White);
            spriteBatch.DrawString(Font, Player, new Vector2(40, 80), Color.MonoGameOrange);

            //Score
            spriteBatch.DrawString(Font, "SCORE", new Vector2(200, 40), Color.White);
            spriteBatch.DrawString(Font, Scores.ToString(), new Vector2(200, 80), Color.MonoGameOrange);

            //coins
            spriteBatch.DrawString(Font, "COINS", new Vector2(360, 40), Color.White);
            coinsprite.Draw(spriteBatch);
            spriteBatch.DrawString(Font, "X" + Coins.ToString(), new Vector2(400, 80), Color.MonoGameOrange);

            //LIVE
            spriteBatch.DrawString(Font, "LIVES", new Vector2(520, 40), Color.White);
            mario.Draw(spriteBatch);
            spriteBatch.DrawString(Font, "X" + Lives.ToString(), new Vector2(560, 80), Color.MonoGameOrange);

            //TIME
            spriteBatch.DrawString(Font, "TIME", new Vector2(680, 40), Color.White);
            spriteBatch.DrawString(Font, ((int)Time).ToString(), new Vector2(680, 80), Color.MonoGameOrange);



            spriteBatch.End();
        }
Esempio n. 2
0
        protected override void Draw(GameTime gameTime)
        {
            if ((GameStatus == GameState.Playing) || (GameStatus == GameState.Pause))
            {
                GraphicsDevice.Clear(Color.CornflowerBlue);
                World.Draw(Location);
                World.Draw(new Vector2(Camera.CameraPositionX, Camera.CameraPositionY));
                MarioSprite.Draw(SpriteBatch, new Vector2(Mario.LocationX - Camera.CameraPositionX, Mario.LocationY));
                PlayerStat.Draw(new Vector2(Camera.CameraPositionX, Camera.CameraPositionY));

                foreach (MarioFireball aFireball in Game1.Mfireballs)
                {
                    aFireball.Draw(SpriteBatch);
                }
                if (Mario.GodStatus)
                {
                    SpriteBatch.Begin();
                    SpriteBatch.Draw(blackHole, new Vector2(MouseState.X - 20, MouseState.Y - 20), Color.White);
                    SpriteBatch.End();
                }
                base.Draw(gameTime);
            }

            else if (GameStatus == GameState.LivesScreen)
            {
                DisableControl = true;
                MediaPlayer.Stop();
                continueTimer += gameTime.ElapsedGameTime.Milliseconds;
                if (continueTimer > 2500)
                {
                    continueTimer -= 2500;
                    GameStatus     = GameState.Playing;
                    MediaPlayer.Play(BackgroundMusic);
                    DisableControl = false;
                }
                GraphicsDevice.Clear(Color.Black);
                PlayerStat.Draw(new Vector2(Camera.CameraPositionX, Camera.CameraPositionY));
                MarioSprite.Draw(SpriteBatch, new Vector2(250, 200));
            }

            else if (GameStatus == GameState.End)
            {
                DisableControl = true;
                MediaPlayer.Stop();
                if (!playSound)
                {
                    Game1Utility.GameOverSoundEffect.Play();
                    playSound = true;
                }
                GraphicsDevice.Clear(Color.Black);
                PlayerStat.Draw(new Vector2(Camera.CameraPositionX, Camera.CameraPositionY));
            }
        }