public void stopall()
 {
     ExplosionTimer.Stop();
     EnemyTimer.Stop();
     EnemyTimer1.Stop();
     EnemyTimer2.Stop();
     EnemyTimer3.Stop();
     EnemyTimer4.Stop();
     BombTimer.Stop();
 }
 private void Form1_Load(object sender, EventArgs e)
 {
     P1.Image    = Properties.Resources._11;
     P1.SizeMode = PictureBoxSizeMode.AutoSize;
     P1.BringToFront();
     bomb.Image    = Properties.Resources.dynamite2;
     bomb.SizeMode = PictureBoxSizeMode.StretchImage;
     bomb.Location = P1.Location;
     bomb.BringToFront();
     EnemyTimer.Start();
     EnemyTimer1.Start();
     EnemyTimer2.Start();
     EnemyTimer3.Start();
     EnemyTimer4.Start();
 }
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            lf = true;
            if (e.KeyCode == Keys.Left && !CheckCollision())
            {
                Anime.Start();
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Left && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X + 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Right && !CheckCollision())
            {
                AnimeRight.Start();
                P1.Location = new Point(P1.Location.X + 5, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Right && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Up && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 5);
                AnimeUp.Start();
            }
            else if (e.KeyCode == Keys.Up && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 4);
            }

            if (e.KeyCode == Keys.Down && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 5);
                AnimeDown.Start();
            }
            else if (e.KeyCode == Keys.Down && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 4);
            }
            if (e.KeyCode == Keys.Z && bomb.Visible == false)
            {
                bomb.Image    = Properties.Resources.graphics_bombs_934360;
                bomb.Location = P1.Location;
                bomb.Visible  = true;
                BombTimer.Start();
            }
            if (e.KeyCode == Keys.P)
            {
                ExplosionTimer.Stop();
                EnemyTimer.Stop();
                EnemyTimer1.Stop();
                EnemyTimer2.Stop();
                EnemyTimer3.Stop();
                EnemyTimer4.Stop();
                BombTimer.Stop();
                label2.Visible       = true;
                pictureBox29.Visible = true;
                P1.Visible           = false;
                bomb.Visible         = false;
                explosion1.Visible   = false;
                explosion2.Visible   = false;
                explosion3.Visible   = false;
                explosion4.Visible   = false;
            }
            if (e.KeyCode == Keys.R)
            {
                EnemyTimer.Start();
                EnemyTimer1.Start();
                EnemyTimer2.Start();
                EnemyTimer3.Start();
                EnemyTimer4.Start();
                label2.Visible       = false;
                pictureBox29.Visible = false;
                P1.Visible           = true;
            }
            //if ((P1.Bounds.IntersectsWith(enemy1.Bounds) && enemy1.Visible == true) || (P1.Bounds.IntersectsWith(enemy2.Bounds) && enemy2.Visible == true) || (P1.Bounds.IntersectsWith(enemy3.Bounds) && enemy3.Visible == true) || (P1.Bounds.IntersectsWith(enemy4.Bounds) && enemy4.Visible == true) || (P1.Bounds.IntersectsWith(enemy5.Bounds) && enemy5.Visible == true))
            ////if (explosion1.Visible && P1.Bounds.IntersectsWith(explosion1.Bounds) || explosion2.Visible && P1.Bounds.IntersectsWith(explosion2.Bounds) || explosion3.Visible && P1.Bounds.IntersectsWith(explosion3.Bounds) || explosion4.Visible && P1.Bounds.IntersectsWith(explosion4.Bounds))
            //{
            //    DEAD3.Visible = true;
            //    P1.Dispose();
            //    stopall();
            //    MessageBox.Show("YOU SUCK!");
            //    Form home = new Form2();
            //    this.Hide();
            //    home.Show();
            //}
            else if (enemy1.Visible == false && enemy2.Visible == false && enemy3.Visible == false && enemy4.Visible == false && enemy5.Visible == false)
            {
                MessageBox.Show("YOU WON!");
                Form home = new Form2();
                this.Hide();
                home.Show();
            }
        }