Beispiel #1
0
        public void gameDone()
        {
            //close game
            timer1.Stop();

            mazePlayer = new MazePlayer(mainGame.Score, mainGame.MainPlayer.Name, mainGame.MainPlayer.Difficulty, mainGame.MainPlayer.PlayerIcon, new Point(0, 0));

            MazeFinale mazeGame = new MazeFinale();

            this.Hide();
            if (mazeGame.ShowDialog() == DialogResult.Cancel)
            {
                if (MazeFinale.atEnd == true)
                {
                    mainGame.passedMaze = true;
                    mainGame.updateScore(0);
                    finalScore = mainGame.Score;
                    mazeGame.Close();
                }
            }
            if (MazeFinale.atEnd == true)
            {
                Win gameWon = new Win();
                this.Hide();
                if (gameWon.ShowDialog() == DialogResult.Cancel)
                {
                    addPlayerInText();
                    gameFinished = true;
                    this.Close();
                }
            }
            else
            {
                this.Hide();
                Lose gameLost = new Lose();
                if (gameLost.ShowDialog() == DialogResult.Cancel)
                {
                    mainGame.Score = 0;
                    gameFinished   = true;
                    this.Close();
                }
            }
        }
Beispiel #2
0
        public MazeFinale()
        {
            InitializeComponent();
            //DoubleBuffered for no flickering
            DoubleBuffered = true;

            startLocation = new Point(18, 18);
            finishPoint   = new Point(1184, 550);
            //default window borders
            top    = 10;
            left   = 10;
            width  = Width - left - 30;
            height = Height - top - 50;

            if (ChooseGame.windowedMode == false)
            {
                this.FormBorderStyle = FormBorderStyle.None;
                this.WindowState     = FormWindowState.Maximized;
                windowAllowed        = false;

                //window borders when in full screen.
                newX          = this.Width / 4;
                newY          = this.Height / 3;
                startLocation = new Point(18 + newX, 18 + newY);
                finishPoint   = new Point(1184 + newX, 550 + newY);
                top          += newX;
                left         += newY;
                width        += newY;
                height       += newX;
            }

            //Get the player from the mainGame
            currentPlayer          = MainGame.mazePlayer;
            currentPlayer.Location = startLocation;



            //Initialize Maze variables
            cellWidth      = 107;
            theStack       = new Stack();
            rand           = new Random();
            cellCount      = 0;
            blackPen       = new Pen(Color.DarkOrange);
            whitePen       = new Pen(Color.DarkBlue);
            endBrushMarker = new SolidBrush(Color.Green);
            flag           = 0;
            blackPen.Width = 10;
            whitePen.Width = 10;
            row            = Convert.ToInt32(6);
            col            = Convert.ToInt32(12);
            whiteMaze      = new List <PointF>();
            blackMaze      = new List <PointF>();



            //Start the timer
            passedTime         = 0;
            lbTime.Text        = Time.ToString();
            mazeTimer.Interval = 1000;
            mazeTimer.Start();
        }