Example #1
0
 public PacmanGame(frmPacmanGame frm, Panel p)
 {
     parentForm  = frm;
     board       = new PacmanBoard(p);
     Pacman      = new PacmanRun(parentForm, board);
     RedGhost    = new GhostRun(parentForm, board, GhostColor.RED);
     BlueGhost   = new GhostRun(parentForm, board, GhostColor.BLUE);
     PinkGhost   = new GhostRun(parentForm, board, GhostColor.PINK);
     YellowGhost = new GhostRun(parentForm, board, GhostColor.YELLOW);
     this.Init();
     RePaint();
 }
Example #2
0
        public void setTarget(PacmanRun pacman, Point blinkyPoint, bool ready, bool originalAI)
        {
            bool outOfB = outOfBox(ghost.Point);

            switch (gState)
            {
            case GhostState.NORMAL:
                if (originalAI && ready)
                {
                    switch (color)
                    {
                    case GhostColor.PINK:
                        algorithm = (stage == 1) ? 2 : 0;
                        pinkAI(pacman.Point, blinkyPoint, ready, outOfB);
                        break;

                    case GhostColor.RED:
                        algorithm = (stage == 1)? 0: 2;
                        redAI(pacman.Point, ready, outOfB);
                        break;

                    case GhostColor.YELLOW:
                        algorithm = (stage == 1) ? 2 : 0;
                        yellowAI(pacman.Point, ready, outOfB);
                        break;

                    case GhostColor.BLUE:
                        algorithm = (stage == 1) ? 0: 2;
                        blueAI(pacman.Point, blinkyPoint, ready, outOfB);
                        break;
                    }
                }
                else
                {
                    redAI(pacman.Point, ready, outOfB);
                }
                break;

            case GhostState.EATEN: enableEaten(); break;

            case GhostState.BONUS:
            case GhostState.BONUSEND: enableFear(pacman.Point); break;
            }
        }
Example #3
0
        public PacmanGame(frmPacmanGame frm, Panel p, Panel pInfo, int difficulty, int algorithm, int pacmanDelay, int ghostDelay, int highScore)
        {
            parentForm  = frm;
            board       = new PacmanBoard(p);
            Pacman      = new PacmanRun(parentForm, board, stage);
            RedGhost    = new GhostRun(parentForm, board, GhostColor.RED, algorithm, stage);
            BlueGhost   = new GhostRun(parentForm, board, GhostColor.BLUE, algorithm, stage);
            PinkGhost   = new GhostRun(parentForm, board, GhostColor.PINK, algorithm, stage);
            YellowGhost = new GhostRun(parentForm, board, GhostColor.YELLOW, algorithm, stage);

            fruit            = new FruitRun(parentForm, board, stage);
            pnlInfo          = pInfo;
            this.difficulty  = difficulty;
            this.algorithm   = algorithm;
            stockGhostDelay  = ghostDelay;
            stockPacmanDelay = pacmanDelay;
            this.highScore   = highScore;
            this.Init();

            RePaint();
        }