Exemplo n.º 1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            pac.Draw(spriteBatch);
            spriteBatch.End();
            spriteBatch.Begin();

            for (int i = 0; i <= Graphics.Viewport.Width / pac.Texture.Width; i++)
            {
                spriteBatch.Draw(pixel, new Rectangle(i * 40, 0, 1, Graphics.Viewport.Height), Color.White);
                spriteBatch.Draw(pixel, new Rectangle(0, i * 40, Graphics.Viewport.Width, 1), Color.White);
            }

            foreach (var fud in food)
            {
                fud.Draw(spriteBatch);
            }

            foreach (var wall in Walls)
            {
                wall.Draw(spriteBatch);
            }

            foreach (var heart in Hearts)
            {
                heart.Draw(spriteBatch);
            }

            foreach (var power in PowerUps)
            {
                power.Draw(spriteBatch);
            }

            blinky.Draw(spriteBatch);
            pinky.Draw(spriteBatch);
            Clyde.Draw(spriteBatch);
            Inky.Draw(spriteBatch);

            if (pac.IsPowerActivated)
            {
                if (pac.elapsedPowerTime >= pac.PowerTime - TimeSpan.FromSeconds(2))
                {
                    spriteBatch.Draw(pixel, new Rectangle(0, 0, Graphics.Viewport.Width, Graphics.Viewport.Height), Color.Red * 0.5f);
                }
                else
                {
                    spriteBatch.Draw(pixel, new Rectangle(0, 0, Graphics.Viewport.Width, Graphics.Viewport.Height), Color.Gray * 0.5f);
                }
            }

            base.Draw(spriteBatch);
        }
Exemplo n.º 2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            currentLevel.Draw(spriteBatch, levelPosition);
            hud.Draw(spriteBatch);

            if (pacman != null)
            {
                pacman.Draw(spriteBatch, levelPosition);
            }
            foreach (Ghost ghost in ghosts)
            {
                ghost.Draw(spriteBatch, levelPosition);
            }
        }