示例#1
0
 public void MoveRight()
 {
     this.setGridPosition(this.X + 1, this.Y);
     board.setGridPositionOccupied(this.X, this.Y);
     board.setGridPositionOpen(this.X - 1, this.Y);
     this.setPosition(board.getPosition(this).X, board.getPosition(this).Y);
 }
示例#2
0
        /* constructor
         *  sets an initial area for the zombie to take up
         *  mymaxX, myminX are the max/min allowed horizontal range for the zombie
         *  mymaxY, myminY are the max/min allowed vertical range for the zombie
         *  Gameboard myboard -- the board which the zombie is moving on
         **/
        public Zombie(int startX, int startY, int mymaxX, int myminX, int mymaxY, int myminY, GameBoard myboard) : base(myboard)
        {
            maxX = mymaxX;
            maxY = mymaxY;
            minX = myminX;
            minY = myminY;

            // start with no zombie vision
            allowVision = false;
            visionMaxX  = 0;
            visionMaxY  = 0;

            allowRangeDetection = true;
            board = myboard;

            this.X = startX;
            this.Y = startY;

            if (board.isGridPositionOpen(this))
            {
                board.setGridPositionOccupied(this.X, this.Y);
            }

            destination = new Rectangle(0, 0, ZOMBIE_WIDTH, ZOMBIE_HEIGHT);
            this.setPosition(board.getPosition(this).X, board.getPosition(this).Y);
            source = new Rectangle(0, 0, ZOMBIE_WIDTH, ZOMBIE_HEIGHT);
        }
示例#3
0
        /* constructor
        *  sets an initial area for the zombie to take up
        *  mymaxX, myminX are the max/min allowed horizontal range for the zombie
        *  mymaxY, myminY are the max/min allowed vertical range for the zombie
        *  Gameboard myboard -- the board which the zombie is moving on
        **/
        public Zombie(int startX, int startY, int mymaxX, int myminX, int mymaxY, int myminY, GameBoard myboard) : base(myboard)
        {
            maxX = mymaxX;
            maxY = mymaxY;
            minX = myminX;
            minY = myminY;

            // start with no zombie vision
            allowVision = false;
            visionMaxX = 0;
            visionMaxY = 0;

            allowRangeDetection = true;
            board = myboard;

            this.X = startX;
            this.Y = startY;

            if (board.isGridPositionOpen(this))
            {
                board.setGridPositionOccupied(this.X, this.Y);
            }

            destination = new Rectangle(0, 0, ZOMBIE_WIDTH, ZOMBIE_HEIGHT);
            this.setPosition(board.getPosition(this).X, board.getPosition(this).Y);
            source = new Rectangle(0, 0, ZOMBIE_WIDTH, ZOMBIE_HEIGHT);
        }
示例#4
0
        public void setLevelState()
        {
            board.setGridPositionOpen(darwin);
            darwin.setGridPosition(2, 2);

            board.setGridPositionOpen(firstZombie);

            firstZombie.setGridPosition(10, 10);

            // reset each leaf for new level
            foreach (Leaf leaf in this.leaves)
            {
                leaf.resetLeaf();
            }

            board.setGridPositionOpen(fastZombie1);
            fastZombie1.chasingDarwin = false;
            fastZombie1.goBackToSleep();
            fastZombie1.setGridPosition(15, 15);

            board.setGridPositionOpen(brain);
            brain.setGridPosition(5, 18);

            darwin.setHuman();
            darwin.setDarwinAlive();
            playDeathSound  = true;
            gameOverCounter = 0;
            firstSwitch.turnOn();
            secondSwitch.turnOn();
            board.setGridPositionOccupied(firstSwitch);
            board.setGridPositionOccupied(secondSwitch);

            gameOver = false;
            gameWin  = false;

            Keyboard.GetState();
        }
示例#5
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameState.setState(GameState.state.Start);
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);

            firstZombie = new Zombie(10, 9, 24, 5, 15, 5, board);
            secondZombie = new Zombie(12, 9, 24, 5, 15, 5, board);
            thirdZombie = new Zombie(8, 8, 24, 5, 15, 5, board);
            fourthZombie = new Zombie(8, 12, 17, 5, 20, 10, board);

            myZombieList= new List<Zombie>();
            myZombieList.Add(firstZombie);
            myZombieList.Add(secondZombie);
            myZombieList.Add(thirdZombie);
            myZombieList.Add(fourthZombie);
            cannibalZombie = new CannibalZombie(29,3,board.getNumSquaresX()-1,1,board.getNumSquaresY()-1,1,myZombieList,darwin,board);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";
            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String cannibalString = "Cannibal Zombies eat\n other zombies!!\n  Use this to\n your advantage!!";
            cannibalMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, cannibalString);

            stairs = new Stairs(board);

            removableWalls = setRemovableWallsInLevelTwo();

            // Initial starting position
            darwin.setGridPosition(21, 20);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            if (board.isGridPositionOpen(27, 20))
            {
                stairs.setGridPosition(27, 20);
                stairs.setDestination(board.getPosition(27, 20));
            }

            zTime = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);

            setWallsInLevelTwo();

            potion = new Potion(board);
            potion.setDestination(board.getPosition(3,3));
            potion.setGridPosition(3, 3);
        }
示例#6
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameState.setState(GameState.state.Start);
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board       = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin      = new Darwin(board);
            firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board);
            //secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board);
            //thirdZombie = new Zombie(16, 10, 15, 5, 15, 5, board);

            fastZombie1 = new FastZombie(15, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, board);

            this.leaves = new LinkedList <Leaf>();

            for (int i = 0; i < leafCount; i++)
            {
                this.leaves.AddLast(new Leaf(board, fastZombie1));
            }

            String zombieString = "This a zombie,\n don't near him \nas a human!!";

            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";

            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String switchString = "This is a switch\n face it and press A\n to see what happens!!";

            switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);

            String brainString = "Move the brain as a \nzombie.\n Zombie's like brains!!";

            brainMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, brainString);

            String fastString = "This one likes\n to sleep.\n Be careful\n not to wake him!!";

            fastMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, fastString);

            secondStair = new Stairs(board);

            brain = new Brain(board, 5, 18);

            BasicObject[] removableWallsAroundStairs = setRemovableWallsAroundStairs();

            BasicObject[] removableWallsAroundSwitch = setRemovableWallsAroundSwitch();

            BasicObject switchSquareOne = new BasicObject(board);

            switchSquareOne.X = 30;
            switchSquareOne.Y = 2;
            firstSwitch       = new Switch(switchSquareOne, board, removableWallsAroundSwitch);

            BasicObject switchSquareTwo = new BasicObject(board);

            switchSquareTwo.X = 2;
            switchSquareTwo.Y = 21;
            secondSwitch      = new Switch(switchSquareTwo, board, removableWallsAroundStairs);

            darwin.setGridPosition(2, 2);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            if (board.isGridPositionOpen(27, 21))
            {
                secondStair.setGridPosition(30, 21);
                secondStair.setDestination(board.getPosition(30, 21));
            }

            // add all the leaves to the map...
            leaves.ElementAt(0).setGridPosition(7, 7);
            leaves.ElementAt(1).setGridPosition(5, 15);
            leaves.ElementAt(2).setGridPosition(4, 2);
            leaves.ElementAt(3).setGridPosition(19, 7);
            leaves.ElementAt(4).setGridPosition(11, 21);
            leaves.ElementAt(5).setGridPosition(7, 8);
            leaves.ElementAt(6).setGridPosition(8, 17);
            leaves.ElementAt(7).setGridPosition(19, 2);
            leaves.ElementAt(8).setGridPosition(19, 1);
            leaves.ElementAt(9).setGridPosition(10, 14);
            leaves.ElementAt(10).setGridPosition(13, 4);
            leaves.ElementAt(11).setGridPosition(13, 3);
            leaves.ElementAt(12).setGridPosition(19, 16);
            leaves.ElementAt(13).setGridPosition(21, 7);
            leaves.ElementAt(14).setGridPosition(2, 16);
            leaves.ElementAt(15).setGridPosition(10, 18);
            leaves.ElementAt(16).setGridPosition(3, 16);
            leaves.ElementAt(17).setGridPosition(16, 15);
            leaves.ElementAt(18).setGridPosition(18, 8);
            leaves.ElementAt(19).setGridPosition(8, 5);
            leaves.ElementAt(20).setGridPosition(5, 7);
            leaves.ElementAt(21).setGridPosition(9, 5);
            leaves.ElementAt(22).setGridPosition(2, 6);
            leaves.ElementAt(23).setGridPosition(8, 8);
            leaves.ElementAt(24).setGridPosition(14, 6);
            leaves.ElementAt(25).setGridPosition(15, 7);
            leaves.ElementAt(26).setGridPosition(15, 8);
            leaves.ElementAt(27).setGridPosition(14, 10);
            leaves.ElementAt(28).setGridPosition(16, 18);
            leaves.ElementAt(29).setGridPosition(14, 22);
            leaves.ElementAt(30).setGridPosition(24, 2);
            leaves.ElementAt(31).setGridPosition(24, 3);
            leaves.ElementAt(32).setGridPosition(25, 6);
            leaves.ElementAt(33).setGridPosition(22, 8);
            leaves.ElementAt(34).setGridPosition(26, 6);
            leaves.ElementAt(35).setGridPosition(25, 10);
            leaves.ElementAt(36).setGridPosition(24, 11);
            leaves.ElementAt(37).setGridPosition(23, 14);
            leaves.ElementAt(38).setGridPosition(22, 17);
            leaves.ElementAt(39).setGridPosition(26, 20);
            leaves.ElementAt(41).setGridPosition(2, 22);
            leaves.ElementAt(42).setGridPosition(2, 20);
            leaves.ElementAt(43).setGridPosition(3, 21);
            leaves.ElementAt(44).setGridPosition(1, 21);
            leaves.ElementAt(45).setGridPosition(2, 18);
            leaves.ElementAt(46).setGridPosition(1, 18);
            leaves.ElementAt(47).setGridPosition(3, 18);
            leaves.ElementAt(48).setGridPosition(4, 18);
            leaves.ElementAt(49).setGridPosition(5, 19);
            leaves.ElementAt(50).setGridPosition(5, 20);
            leaves.ElementAt(51).setGridPosition(5, 21);
            leaves.ElementAt(52).setGridPosition(5, 22);
            leaves.ElementAt(53).setGridPosition(4, 1);
            leaves.ElementAt(54).setGridPosition(4, 2);
            leaves.ElementAt(55).setGridPosition(4, 3);
            leaves.ElementAt(56).setGridPosition(4, 4);
            leaves.ElementAt(57).setGridPosition(4, 5);
            leaves.ElementAt(58).setGridPosition(4, 6);
            leaves.ElementAt(59).setGridPosition(4, 7);
            leaves.ElementAt(60).setGridPosition(4, 8);
            leaves.ElementAt(61).setGridPosition(4, 9);
            leaves.ElementAt(62).setGridPosition(4, 10);
            leaves.ElementAt(63).setGridPosition(4, 11);
            leaves.ElementAt(64).setGridPosition(4, 12);
            leaves.ElementAt(65).setGridPosition(4, 13);
            leaves.ElementAt(66).setGridPosition(10, 4);
            leaves.ElementAt(67).setGridPosition(10, 5);
            leaves.ElementAt(68).setGridPosition(10, 6);
            leaves.ElementAt(69).setGridPosition(10, 7);
            leaves.ElementAt(70).setGridPosition(10, 8);
            leaves.ElementAt(71).setGridPosition(10, 9);
            leaves.ElementAt(72).setGridPosition(10, 10);
            leaves.ElementAt(73).setGridPosition(10, 11);
            leaves.ElementAt(74).setGridPosition(10, 12);
            leaves.ElementAt(75).setGridPosition(10, 13);
            leaves.ElementAt(76).setGridPosition(10, 14);
            leaves.ElementAt(77).setGridPosition(10, 15);
            leaves.ElementAt(78).setGridPosition(10, 16);
            leaves.ElementAt(79).setGridPosition(10, 17);
            leaves.ElementAt(80).setGridPosition(10, 18);
            leaves.ElementAt(81).setGridPosition(10, 19);
            leaves.ElementAt(82).setGridPosition(11, 19);
            leaves.ElementAt(83).setGridPosition(12, 19);
            leaves.ElementAt(84).setGridPosition(13, 19);
            leaves.ElementAt(85).setGridPosition(14, 19);
            leaves.ElementAt(86).setGridPosition(15, 19);
            leaves.ElementAt(87).setGridPosition(16, 19);
            leaves.ElementAt(88).setGridPosition(17, 19);
            leaves.ElementAt(89).setGridPosition(18, 19);
            leaves.ElementAt(90).setGridPosition(19, 19);
            leaves.ElementAt(91).setGridPosition(20, 19);
            leaves.ElementAt(92).setGridPosition(21, 19);
            leaves.ElementAt(93).setGridPosition(22, 19);
            leaves.ElementAt(94).setGridPosition(23, 19);
            leaves.ElementAt(95).setGridPosition(23, 18);
            leaves.ElementAt(96).setGridPosition(23, 17);
            leaves.ElementAt(97).setGridPosition(23, 16);
            leaves.ElementAt(98).setGridPosition(23, 15);
            leaves.ElementAt(99).setGridPosition(23, 14);
            leaves.ElementAt(100).setGridPosition(23, 13);
            leaves.ElementAt(101).setGridPosition(23, 12);
            leaves.ElementAt(102).setGridPosition(23, 11);
            leaves.ElementAt(103).setGridPosition(23, 10);
            leaves.ElementAt(104).setGridPosition(23, 9);
            leaves.ElementAt(105).setGridPosition(23, 8);
            leaves.ElementAt(106).setGridPosition(23, 7);
            leaves.ElementAt(107).setGridPosition(23, 6);
            leaves.ElementAt(108).setGridPosition(23, 5);
            leaves.ElementAt(109).setGridPosition(23, 4);
            leaves.ElementAt(110).setGridPosition(22, 4);
            leaves.ElementAt(111).setGridPosition(21, 4);
            leaves.ElementAt(112).setGridPosition(20, 4);
            leaves.ElementAt(113).setGridPosition(19, 4);
            leaves.ElementAt(114).setGridPosition(18, 4);
            leaves.ElementAt(115).setGridPosition(17, 4);
            leaves.ElementAt(116).setGridPosition(16, 4);
            leaves.ElementAt(117).setGridPosition(15, 4);
            leaves.ElementAt(118).setGridPosition(14, 4);
            leaves.ElementAt(119).setGridPosition(13, 4);
            leaves.ElementAt(120).setGridPosition(12, 4);
            leaves.ElementAt(121).setGridPosition(11, 4);

            leaves.ElementAt(134).setGridPosition(27, 1);
            leaves.ElementAt(135).setGridPosition(27, 2);
            leaves.ElementAt(136).setGridPosition(27, 3);

            leaves.ElementAt(122).setGridPosition(27, 4);
            leaves.ElementAt(123).setGridPosition(27, 5);
            leaves.ElementAt(124).setGridPosition(27, 6);
            leaves.ElementAt(125).setGridPosition(27, 7);
            leaves.ElementAt(126).setGridPosition(27, 8);
            leaves.ElementAt(127).setGridPosition(27, 9);
            leaves.ElementAt(128).setGridPosition(27, 10);
            leaves.ElementAt(129).setGridPosition(27, 11);
            leaves.ElementAt(130).setGridPosition(27, 12);
            leaves.ElementAt(131).setGridPosition(27, 13);
            leaves.ElementAt(132).setGridPosition(27, 14);
            leaves.ElementAt(133).setGridPosition(27, 15);

            zTime      = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);
        }
示例#7
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            // set up all basic game objects for level1 here
            gameState  = new GameState();
            gameStart  = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);
            gameStart2 = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board        = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin       = new Darwin(board);
            firstZombie  = new Zombie(10, 10, 15, 5, 15, 5, board);
            secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board);
            thirdZombie  = new Zombie(12, 10, 15, 5, 15, 5, board);
            fourthZombie = new Zombie(20, 7, 27, 15, 22, 2, board);
            fifthZombie  = new Zombie(22, 10, 25, 15, 22, 2, board);
            sixthZombie  = new Zombie(21, 4, 25, 15, 15, 2, board);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";

            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";

            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String switchString = "This is a switch\n face it and press A\n to see what happens!!";

            switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);

            String brainString = "Move the brain as a \nzombie.\n Zombie's like brains!!";

            brainMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, brainString);

            stairs = new Stairs(board);

            brain = new Brain(board, 3, 3);

            BasicObject[] removableWalls = setRemovableWallsInLevelOne();

            BasicObject switchSquare = new BasicObject(board);

            switchSquare.X = 13;
            switchSquare.Y = 2;

            firstSwitch = new Switch(switchSquare, board, removableWalls);

            // Initial starting position
            darwin.setGridPosition(2, 20);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            if (board.isGridPositionOpen(21, 20))
            {
                stairs.setGridPosition(27, 21);
                stairs.setDestination(board.getPosition(27, 21));
            }

            zTime = new ZombieTime(board);

            vortex = new Vortex(board, 19, 20);

            setPotionPosition(25, 4);

            setWalls();
        }
示例#8
0
        // for conveniently reseting level
        public void setLevelState()
        {
            gameOver = false;
            gameWin  = false;

            fellDownPit     = false;
            fellDownCounter = 0;

            board.setGridPositionOpen(darwin);
            darwin.setGridPosition(2, 20);

            zTime.reset();

            board.setGridPositionOpen(firstZombie);
            board.setGridPositionOpen(secondZombie);
            board.setGridPositionOpen(thirdZombie);
            board.setGridPositionOpen(fourthZombie);
            board.setGridPositionOpen(fifthZombie);
            board.setGridPositionOpen(sixthZombie);
            board.setGridPositionOpen(brain);
            board.setGridPositionOpen(potion);

            firstZombie.setGridPosition(10, 10);
            board.setGridPositionOccupied(firstZombie.X, firstZombie.Y);
            firstZombie.setZombieAlive(true);

            secondZombie.setGridPosition(10, 16);
            board.setGridPositionOccupied(secondZombie.X, secondZombie.Y);
            secondZombie.setZombieAlive(true);

            thirdZombie.setGridPosition(12, 10);
            board.setGridPositionOccupied(thirdZombie.X, thirdZombie.Y);
            thirdZombie.setZombieAlive(true);

            fourthZombie.setGridPosition(20, 7);
            board.setGridPositionOccupied(fourthZombie.X, fourthZombie.Y);
            fourthZombie.setZombieAlive(true);

            fifthZombie.setGridPosition(22, 10);
            board.setGridPositionOccupied(fifthZombie.X, fifthZombie.Y);
            fifthZombie.setZombieAlive(true);

            sixthZombie.setGridPosition(22, 10);
            board.setGridPositionOccupied(sixthZombie.X, sixthZombie.Y);
            sixthZombie.setZombieAlive(true);

            potion.setGridPosition(25, 4);

            brain.setGridPosition(3, 3);
            brain.setVisible(true);
            board.setGridPositionOccupied(brain.X, brain.Y);

            potion.reset();
            darwin.setHuman();
            darwin.setDarwinAlive();
            playDeathSound = true;
            firstSwitch.turnOn();

            firstSwitch.turnOn();

            Keyboard.GetState();
        }
示例#9
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameState.setState(GameState.state.Start);
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);
            firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board);
            //secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board);
            //thirdZombie = new Zombie(16, 10, 15, 5, 15, 5, board);

            fastZombie1 = new FastZombie(15, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, board);

            this.leaves = new LinkedList<Leaf>();

            for (int i = 0; i < leafCount; i++)
            {
                this.leaves.AddLast(new Leaf(board, fastZombie1));
            }

            String zombieString = "This a zombie,\n don't near him \nas a human!!";
            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String switchString = "This is a switch\n face it and press A\n to see what happens!!";
            switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);

            String brainString = "Move the brain as a \nzombie.\n Zombie's like brains!!";
            brainMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, brainString);

            String fastString = "This one likes\n to sleep.\n Be careful\n not to wake him!!";
            fastMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, fastString);

            secondStair = new Stairs(board);

            brain = new Brain(board, 5, 18);

            BasicObject[] removableWallsAroundStairs = setRemovableWallsAroundStairs();

            BasicObject[] removableWallsAroundSwitch = setRemovableWallsAroundSwitch();

            BasicObject switchSquareOne = new BasicObject(board);
            switchSquareOne.X = 30;
            switchSquareOne.Y = 2;
            firstSwitch = new Switch(switchSquareOne, board, removableWallsAroundSwitch);

            BasicObject switchSquareTwo = new BasicObject(board);
            switchSquareTwo.X = 2;
            switchSquareTwo.Y = 21;
            secondSwitch = new Switch(switchSquareTwo, board, removableWallsAroundStairs);

            darwin.setGridPosition(2, 2);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            if (board.isGridPositionOpen(27, 21))
            {
                secondStair.setGridPosition(30, 21);
                secondStair.setDestination(board.getPosition(30, 21));
            }

            // add all the leaves to the map...
            leaves.ElementAt(0).setGridPosition(7, 7);
            leaves.ElementAt(1).setGridPosition(5, 15);
            leaves.ElementAt(2).setGridPosition(4, 2);
            leaves.ElementAt(3).setGridPosition(19, 7);
            leaves.ElementAt(4).setGridPosition(11, 21);
            leaves.ElementAt(5).setGridPosition(7, 8);
            leaves.ElementAt(6).setGridPosition(8, 17);
            leaves.ElementAt(7).setGridPosition(19, 2);
            leaves.ElementAt(8).setGridPosition(19, 1);
            leaves.ElementAt(9).setGridPosition(10, 14);
            leaves.ElementAt(10).setGridPosition(13, 4);
            leaves.ElementAt(11).setGridPosition(13, 3);
            leaves.ElementAt(12).setGridPosition(19, 16);
            leaves.ElementAt(13).setGridPosition(21, 7);
            leaves.ElementAt(14).setGridPosition(2, 16);
            leaves.ElementAt(15).setGridPosition(10, 18);
            leaves.ElementAt(16).setGridPosition(3, 16);
            leaves.ElementAt(17).setGridPosition(16, 15);
            leaves.ElementAt(18).setGridPosition(18, 8);
            leaves.ElementAt(19).setGridPosition(8, 5);
            leaves.ElementAt(20).setGridPosition(5, 7);
            leaves.ElementAt(21).setGridPosition(9, 5);
            leaves.ElementAt(22).setGridPosition(2, 6);
            leaves.ElementAt(23).setGridPosition(8, 8);
            leaves.ElementAt(24).setGridPosition(14, 6);
            leaves.ElementAt(25).setGridPosition(15, 7);
            leaves.ElementAt(26).setGridPosition(15, 8);
            leaves.ElementAt(27).setGridPosition(14, 10);
            leaves.ElementAt(28).setGridPosition(16, 18);
            leaves.ElementAt(29).setGridPosition(14, 22);
            leaves.ElementAt(30).setGridPosition(24, 2);
            leaves.ElementAt(31).setGridPosition(24, 3);
            leaves.ElementAt(32).setGridPosition(25, 6);
            leaves.ElementAt(33).setGridPosition(22, 8);
            leaves.ElementAt(34).setGridPosition(26, 6);
            leaves.ElementAt(35).setGridPosition(25, 10);
            leaves.ElementAt(36).setGridPosition(24, 11);
            leaves.ElementAt(37).setGridPosition(23, 14);
            leaves.ElementAt(38).setGridPosition(22, 17);
            leaves.ElementAt(39).setGridPosition(26, 20);
            leaves.ElementAt(41).setGridPosition(2, 22);
            leaves.ElementAt(42).setGridPosition(2, 20);
            leaves.ElementAt(43).setGridPosition(3, 21);
            leaves.ElementAt(44).setGridPosition(1, 21);
            leaves.ElementAt(45).setGridPosition(2, 18);
            leaves.ElementAt(46).setGridPosition(1, 18);
            leaves.ElementAt(47).setGridPosition(3, 18);
            leaves.ElementAt(48).setGridPosition(4, 18);
            leaves.ElementAt(49).setGridPosition(5, 19);
            leaves.ElementAt(50).setGridPosition(5, 20);
            leaves.ElementAt(51).setGridPosition(5, 21);
            leaves.ElementAt(52).setGridPosition(5, 22);
            leaves.ElementAt(53).setGridPosition(4, 1);
            leaves.ElementAt(54).setGridPosition(4, 2);
            leaves.ElementAt(55).setGridPosition(4, 3);
            leaves.ElementAt(56).setGridPosition(4, 4);
            leaves.ElementAt(57).setGridPosition(4, 5);
            leaves.ElementAt(58).setGridPosition(4, 6);
            leaves.ElementAt(59).setGridPosition(4, 7);
            leaves.ElementAt(60).setGridPosition(4, 8);
            leaves.ElementAt(61).setGridPosition(4, 9);
            leaves.ElementAt(62).setGridPosition(4, 10);
            leaves.ElementAt(63).setGridPosition(4, 11);
            leaves.ElementAt(64).setGridPosition(4, 12);
            leaves.ElementAt(65).setGridPosition(4, 13);
            leaves.ElementAt(66).setGridPosition(10, 4);
            leaves.ElementAt(67).setGridPosition(10, 5);
            leaves.ElementAt(68).setGridPosition(10, 6);
            leaves.ElementAt(69).setGridPosition(10, 7);
            leaves.ElementAt(70).setGridPosition(10, 8);
            leaves.ElementAt(71).setGridPosition(10, 9);
            leaves.ElementAt(72).setGridPosition(10, 10);
            leaves.ElementAt(73).setGridPosition(10, 11);
            leaves.ElementAt(74).setGridPosition(10, 12);
            leaves.ElementAt(75).setGridPosition(10, 13);
            leaves.ElementAt(76).setGridPosition(10, 14);
            leaves.ElementAt(77).setGridPosition(10, 15);
            leaves.ElementAt(78).setGridPosition(10, 16);
            leaves.ElementAt(79).setGridPosition(10, 17);
            leaves.ElementAt(80).setGridPosition(10, 18);
            leaves.ElementAt(81).setGridPosition(10, 19);
            leaves.ElementAt(82).setGridPosition(11, 19);
            leaves.ElementAt(83).setGridPosition(12, 19);
            leaves.ElementAt(84).setGridPosition(13, 19);
            leaves.ElementAt(85).setGridPosition(14, 19);
            leaves.ElementAt(86).setGridPosition(15, 19);
            leaves.ElementAt(87).setGridPosition(16, 19);
            leaves.ElementAt(88).setGridPosition(17, 19);
            leaves.ElementAt(89).setGridPosition(18, 19);
            leaves.ElementAt(90).setGridPosition(19, 19);
            leaves.ElementAt(91).setGridPosition(20, 19);
            leaves.ElementAt(92).setGridPosition(21, 19);
            leaves.ElementAt(93).setGridPosition(22, 19);
            leaves.ElementAt(94).setGridPosition(23, 19);
            leaves.ElementAt(95).setGridPosition(23, 18);
            leaves.ElementAt(96).setGridPosition(23, 17);
            leaves.ElementAt(97).setGridPosition(23, 16);
            leaves.ElementAt(98).setGridPosition(23, 15);
            leaves.ElementAt(99).setGridPosition(23, 14);
            leaves.ElementAt(100).setGridPosition(23, 13);
            leaves.ElementAt(101).setGridPosition(23, 12);
            leaves.ElementAt(102).setGridPosition(23, 11);
            leaves.ElementAt(103).setGridPosition(23, 10);
            leaves.ElementAt(104).setGridPosition(23, 9);
            leaves.ElementAt(105).setGridPosition(23, 8);
            leaves.ElementAt(106).setGridPosition(23, 7);
            leaves.ElementAt(107).setGridPosition(23, 6);
            leaves.ElementAt(108).setGridPosition(23, 5);
            leaves.ElementAt(109).setGridPosition(23, 4);
            leaves.ElementAt(110).setGridPosition(22, 4);
            leaves.ElementAt(111).setGridPosition(21, 4);
            leaves.ElementAt(112).setGridPosition(20, 4);
            leaves.ElementAt(113).setGridPosition(19, 4);
            leaves.ElementAt(114).setGridPosition(18, 4);
            leaves.ElementAt(115).setGridPosition(17, 4);
            leaves.ElementAt(116).setGridPosition(16, 4);
            leaves.ElementAt(117).setGridPosition(15, 4);
            leaves.ElementAt(118).setGridPosition(14, 4);
            leaves.ElementAt(119).setGridPosition(13, 4);
            leaves.ElementAt(120).setGridPosition(12, 4);
            leaves.ElementAt(121).setGridPosition(11, 4);

            leaves.ElementAt(134).setGridPosition(27, 1);
            leaves.ElementAt(135).setGridPosition(27, 2);
            leaves.ElementAt(136).setGridPosition(27, 3);

            leaves.ElementAt(122).setGridPosition(27, 4);
            leaves.ElementAt(123).setGridPosition(27, 5);
            leaves.ElementAt(124).setGridPosition(27, 6);
            leaves.ElementAt(125).setGridPosition(27, 7);
            leaves.ElementAt(126).setGridPosition(27, 8);
            leaves.ElementAt(127).setGridPosition(27, 9);
            leaves.ElementAt(128).setGridPosition(27, 10);
            leaves.ElementAt(129).setGridPosition(27, 11);
            leaves.ElementAt(130).setGridPosition(27, 12);
            leaves.ElementAt(131).setGridPosition(27, 13);
            leaves.ElementAt(132).setGridPosition(27, 14);
            leaves.ElementAt(133).setGridPosition(27, 15);

            zTime = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);
        }
示例#10
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            // set up all basic game objects for level1 here
            gameState = new GameState();
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);
            gameStart2 = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);
            firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board);
            secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board);
            thirdZombie = new Zombie(12, 10, 15, 5, 15, 5, board);
            fourthZombie = new Zombie(20, 7, 27, 15, 22, 2, board);
            fifthZombie = new Zombie(22, 10, 25, 15, 22, 2, board);
            sixthZombie = new Zombie(21, 4, 25, 15, 15, 2, board);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";
            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String switchString = "This is a switch\n face it and press A\n to see what happens!!";
            switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);

            String brainString = "Move the brain as a \nzombie.\n Zombie's like brains!!";
            brainMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, brainString);

            stairs = new Stairs(board);

            brain = new Brain(board, 3, 3);

            BasicObject[] removableWalls = setRemovableWallsInLevelOne();

            BasicObject switchSquare = new BasicObject(board);
            switchSquare.X = 13;
            switchSquare.Y = 2;

            firstSwitch = new Switch(switchSquare, board, removableWalls);

            // Initial starting position
            darwin.setGridPosition(2, 20);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            if (board.isGridPositionOpen(21, 20))
            {
                stairs.setGridPosition(27, 21);
                stairs.setDestination(board.getPosition(27, 21));
            }

            zTime = new ZombieTime(board);

            vortex = new Vortex(board, 19, 20);

            setPotionPosition(25, 4);

            setWalls();
        }
示例#11
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameState.setState(GameState.state.Start);
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);

            board  = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);

            firstZombie  = new Zombie(10, 9, 24, 5, 15, 5, board);
            secondZombie = new Zombie(12, 9, 24, 5, 15, 5, board);
            thirdZombie  = new Zombie(8, 8, 24, 5, 15, 5, board);
            fourthZombie = new Zombie(8, 12, 17, 5, 20, 10, board);

            myZombieList = new List <Zombie>();
            myZombieList.Add(firstZombie);
            myZombieList.Add(secondZombie);
            myZombieList.Add(thirdZombie);
            myZombieList.Add(fourthZombie);
            cannibalZombie = new CannibalZombie(29, 3, board.getNumSquaresX() - 1, 1, board.getNumSquaresY() - 1, 1, myZombieList, darwin, board);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";

            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";

            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String cannibalString = "Cannibal Zombies eat\n other zombies!!\n  Use this to\n your advantage!!";

            cannibalMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, cannibalString);

            stairs = new Stairs(board);

            removableWalls = setRemovableWallsInLevelTwo();

            // Initial starting position
            darwin.setGridPosition(21, 20);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            if (board.isGridPositionOpen(27, 20))
            {
                stairs.setGridPosition(27, 20);
                stairs.setDestination(board.getPosition(27, 20));
            }

            zTime      = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);

            setWallsInLevelTwo();

            potion = new Potion(board);
            potion.setDestination(board.getPosition(3, 3));
            potion.setGridPosition(3, 3);
        }
示例#12
0
        public void setLevelState()
        {
            board.setGridPositionOpen(darwin);
            darwin.setGridPosition(21, 20);
            board.setGridPositionOccupied(darwin);

            board.setGridPositionOpen(firstZombie.X, firstZombie.Y);
            firstZombie.setGridPosition(10, 9);
            board.setGridPositionOccupied(firstZombie.X, firstZombie.Y);
            firstZombie.setZombieAlive(true);

            board.setGridPositionOpen(secondZombie.X, secondZombie.Y);
            secondZombie.setGridPosition(12, 9);
            board.setGridPositionOccupied(secondZombie.X, secondZombie.Y);
            secondZombie.setZombieAlive(true);

            board.setGridPositionOpen(thirdZombie.X, thirdZombie.Y);
            thirdZombie.setGridPosition(8, 8);
            board.setGridPositionOccupied(thirdZombie.X, thirdZombie.Y);
            thirdZombie.setZombieAlive(true);

            board.setGridPositionOpen(fourthZombie.X, fourthZombie.Y);
            fourthZombie.setGridPosition(8, 12);
            board.setGridPositionOccupied(fourthZombie.X, fourthZombie.Y);
            fourthZombie.setZombieAlive(true);

            List <Zombie> myZombieList = new List <Zombie>();

            myZombieList.Add(firstZombie);
            myZombieList.Add(secondZombie);
            myZombieList.Add(thirdZombie);
            myZombieList.Add(fourthZombie);
            cannibalZombie.updateListOfZombies(myZombieList);

            board.setGridPositionOpen(cannibalZombie.X, cannibalZombie.Y);
            cannibalZombie.setGridPosition(29, 3);
            board.setGridPositionOccupied(cannibalZombie.X, cannibalZombie.Y);
            cannibalZombie.setZombieAlive(true);

            potion.setGridPosition(3, 3);
            potion.reset();

            zTime.reset();
            zTime.setTime(zTimeReset.getTime());

            darwin.setHuman();
            darwin.setDarwinAlive();
            playDeathSound  = true;
            playSound       = true;
            gameOverCounter = 0;
            gameOver        = false;
            gameWin         = false;

            Keyboard.GetState();
        }