Exemple #1
0
        public void winGame()
        {
            timer1.Stop();
            this.Hide();
            WinGame w = new WinGame();

            w.Show();
        }
 private void end_game()
 {
     gameTimer.Stop();
     if (score == 10)
     {
         this.Hide();
         WinGame w = new WinGame();
         w.Show();
     }
     else
     {
         this.Hide();
         LoseGame l = new LoseGame(score);
         l.Show();
     }
 }
        private void timer6_Tick(object sender, EventArgs e)
        {
            if (position == pozicija.left && left)
            {
                pinkPanter.Left -= 5;
            }
            else if (position == pozicija.right && right)
            {
                pinkPanter.Left += 5;
            }
            else if (position == pozicija.up && up)
            {
                pinkPanter.Top -= 5;
            }
            else if (position == pozicija.down && down)
            {
                pinkPanter.Top += 5;
            }

            if (pinkPanter.Bounds.IntersectsWith(pictureBox1.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox2.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox3.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox4.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox5.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox6.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox7.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox8.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox9.Bounds))
            {
                endGame();
            }
            else if (pinkPanter.Bounds.IntersectsWith(pictureBox10.Bounds))
            {
                endGame();
            }
            else if (laser.Visible && pinkPanter.Bounds.IntersectsWith(laser.Bounds))
            {
                endGame();
            }
            else if (boxClosed1.Visible && pinkPanter.Bounds.IntersectsWith(boxClosed1.Bounds))
            {
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(494, 86);
                boxClosed1.Visible  = false;
                boxOpened1.Visible  = true;
                NextStep n = new NextStep("Go ist, to the center,\nthat is where another box\nyou will find!");
                n.Show();
            }
            else if (boxOpened1.Visible && pinkPanter.Bounds.IntersectsWith(boxOpened1.Bounds))
            {
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(494, 86);
                NextStep n = new NextStep("Go east, to the center,\nthat is where another box\nyou will find!");
                n.Show();
            }
            else if (boxOpened1.Visible && pinkPanter.Bounds.IntersectsWith(boxOpened2.Bounds))
            {
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(792, 213);
                boxOpened2.Visible  = true;
                NextStep n = new NextStep("After the first block,\nat the bottom\nis where you need to go!");
                n.Show();
            }
            else if (boxOpened2.Visible && pinkPanter.Bounds.IntersectsWith(boxOpened2.Bounds))
            {
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(792, 213);
                NextStep n = new NextStep("After the first block,\nat the bottom\nis where you need to go!");
                n.Show();
            }
            else if (boxOpened2.Visible && pinkPanter.Bounds.IntersectsWith(boxOpened3.Bounds))
            {
                boxOpened3.Visible = true;
                diamond.Visible    = true;
                laser.Visible      = true;
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(195, 308);
                NextStep n = new NextStep("Watch out\nfor the laser\n and\nget the diamond!");
                n.Show();
            }
            else if (boxOpened3.Visible && pinkPanter.Bounds.IntersectsWith(boxOpened3.Bounds))
            {
                left  = false;
                right = false;
                down  = false;
                up    = false;
                pinkPanter.Location = new Point(195, 308);
                NextStep n = new NextStep("Watch out\nfor the laser\n and\nget the diamond!");
                n.Show();
            }
            else if (diamond.Visible && pinkPanter.Bounds.IntersectsWith(diamond.Bounds))
            {
                diamond.Visible = false;
                timer1.Start();
                timer2.Start();
                timer3.Start();
                timer4.Start();
                timer5.Start();
                timer6.Start();
                this.Hide();
                WinGame w = new WinGame();
                w.Show();
            }
        }