예제 #1
0
        public void newGame(int height, int width)
        {
            player = new Player(height, 1);
            scoreCounterLbl.Text = "Score: 1000";
            startGame            = false;
            timePassed           = 0;
            MazeGenerator mg = new MazeGenerator(WORLD_HEIGHT, WORLD_WIDTH);

            maze                 = mg.generate();
            mg                   = null;
            door                 = new Door(1, WORLD_WIDTH);
            this.Width           = 600 + 16;
            this.Height          = 600 + 42;
            SIDE                 = 600 / Math.Max(WORLD_WIDTH + 2, WORLD_HEIGHT + 2);
            this.FormBorderStyle = FormBorderStyle.FixedSingle; //disables resize
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            playSimpleSound();
            timer          = new System.Windows.Forms.Timer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = SLEEP_INTERVAL;
            timer.Start();
            timerAnim          = new System.Windows.Forms.Timer();
            timerAnim.Tick    += new EventHandler(timerAnim_Tick);
            timerAnim.Interval = 1000 / TIMER_INTERVAL;
            Invalidate();
        }
예제 #2
0
        public void newGame(int height, int width)
        {
            player = new Player(height, 1);
            scoreCounterLbl.Text = "Score: 1000";
            timePassed           = 0;
            MazeGenerator mg = new MazeGenerator(WORLD_HEIGHT, WORLD_WIDTH);

            maze                 = mg.generate();
            mg                   = null;
            door                 = new Door(1, WORLD_WIDTH);
            this.Width           = 600 + 16;
            this.Height          = 600 + 42;
            SIDE                 = 600 / Math.Max(WORLD_WIDTH + 2, WORLD_HEIGHT + 2);
            this.FormBorderStyle = FormBorderStyle.FixedSingle; //disables resize
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            playSimpleSound();
            scoreTimer.Start();
        }