示例#1
0
        public void initLevel()
        {
            tmpXSpeed = player.getXSpeed();
            tmpYSpeed = player.getYSpeed();

            for (int i = 1; i < 36; i++)
            {
                Pellet p = new Pellet(32 + (i * 20), 50, 10, 10, Color.Yellow);
                pellets.Add(p);
            }

            for (int i = 1; i < 25; i++)
            {
                Pellet p = new Pellet(52, 50 + (i * 20), 10, 10, Color.Yellow);
                pellets.Add(p);
            }

            Ghost g = new Ghost(100, 250, 32, GHOST_SPEED, 0, "ambush", Color.Red);

            ghosts.Add(g);

            Wall w  = new Wall(25, 25, 12, 240, Color.Blue);
            Wall w2 = new Wall(25, 25, 740, 12, Color.Blue);
            Wall w3 = new Wall(765, 25, 12, 240, Color.Blue);
            Wall w4 = new Wall(25, 305, 12, 240, Color.Blue);
            Wall w5 = new Wall(765, 305, 12, 240, Color.Blue);
            Wall w6 = new Wall(25, 545, 752, 12, Color.Blue);
            Wall w7 = new Wall(15, 305, 12, 15, Color.Yellow);

            // TODO: Figure out a way to have pac-man teleport when he exits

            walls.Add(w);
            walls.Add(w2);
            walls.Add(w3);
            walls.Add(w4);
            walls.Add(w5);
            walls.Add(w6);
        }
示例#2
0
        public void initLevel()
        {
            // reset score
            score = 0;

            // set the temp x and y of pacman
            tmpXSpeed = player.getXSpeed();
            tmpYSpeed = player.getYSpeed();

            createPellets();

            // create ghosts
            Ghost g  = new Ghost(ghostX, ghostY, 32, GHOST_SPEED, 0, 200, "aggressive", Color.Red);
            Ghost g2 = new Ghost(ghostBoxX, ghostBoxY, 32, GHOST_SPEED, 0, 200, "patrol", Color.Lime);

            ghosts.Clear();
            ghosts.Add(g);
            ghosts.Add(g2);

            createWalls();
        }