Ejemplo n.º 1
0
        public void ShowScene()
        {
            brush1.Color = Color.Black;
            DBgrfx.FillRectangle(brush1, new Rectangle(0, 0, this.Width, this.Height));

            maze.DrawMaze(DBgrfx);

            RGhost.DrawItem(DBgrfx);
            YGhost.DrawItem(DBgrfx);
            BGhost.DrawItem(DBgrfx);
            PGhost.DrawItem(DBgrfx);
            Pman.DrawItem(DBgrfx);

            DBgrfx.DrawString("Score:" + Pman.GetScore(), text, new SolidBrush(Color.White), 0, 650);
            DBgrfx.DrawString("Ammo:" + Pman.GetAmmo(), text, new SolidBrush(Color.White), 500, 650);
            DBgrfx.DrawString("Tries:" + Pman.GetTries(), text, new SolidBrush(Color.White), 265, 650);

            if (ShootOnce)
            {
                bullet.DrawItem(DBgrfx);
            }
            try
            {
                grfx.DrawImage(BackBuffer, 0, 0);
            }
            catch
            {
                DrawingTimer.Stop();
            }
        }
Ejemplo n.º 2
0
        private void Animation_Tick(object sender, EventArgs e)
        {
            _dBgrfx.DrawImage(Properties.Resources.Menu, -10, 0, Width, Height - 50);

            PM1.SetX(PM1.GetX() + 15);
            RG.SetX(RG.GetX() + 15);
            BG.SetX(BG.GetX() + 15);
            YG.SetX(YG.GetX() + 15);
            PG.SetX(PG.GetX() + 15);

            if (PacmanPicState == 1)
            {
                PM1.SetImage(Properties.Resources.Pacman2);
                PacmanPicState = 2;
            }
            else
            {
                PM1.SetImage(Properties.Resources.Pacman1);
                PacmanPicState = 1;
            }

            if (PM1.GetX() > Width)
            {
                PM1.SetX(0);
            }
            if (RG.GetX() > Width)
            {
                RG.SetX(0);
            }
            if (BG.GetX() > Width)
            {
                BG.SetX(0);
            }
            if (YG.GetX() > Width)
            {
                YG.SetX(0);
            }
            if (PG.GetX() > Width)
            {
                PG.SetX(0);
            }

            PM1.DrawItem(_dBgrfx);
            PM2.DrawItem(_dBgrfx);
            RG.DrawItem(_dBgrfx);
            BG.DrawItem(_dBgrfx);
            YG.DrawItem(_dBgrfx);
            PG.DrawItem(_dBgrfx);

            grfx.DrawImage(_backBuffer, 0, 0);
        }