Beispiel #1
0
        private void UpdateLevelState(GameTime gameTime)
        {
            checkLevelOver();
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            if (darwin.isDarwinAlive())
            {
                checkForExitGame(ks);

                checkForGameOver();

                if (fatBossZombie.isZombieAlive())
                {
                    checkForGameOverWithBoss();
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;

            if (fatBossZombie.isZombieAlive())
            {
                fatBossZombie.checkForBabyDeaths(nurseryOne, nurseryTwo);
            }

            nurseryOne.Update(gameTime);
            nurseryTwo.Update(gameTime);

            if (fatBossZombie.isZombieAlive())
            {
                fatBossZombie.Update(gameTime);
            }

            updateFirstBabyWaveExplosion();
            updateSecondBabyWaveExplosion();
        }
Beispiel #2
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    checkForGameOver(firstZombie);
                    checkForGameOver(fastZombie1);
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            secondStair.Update(gameTime, darwin);

            firstZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            firstZombie.Update(gameTime, darwin, brain);

            foreach (Leaf leaf in this.leaves)
            {
                leaf.Update(darwin);
            }

            fastZombie1.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            fastZombie1.Update(gameTime, darwin, brain);

            //secondZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            //secondZombie.Update(gameTime, darwin, brain);
            //thirdZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            //thirdZombie.Update(gameTime, darwin, brain);

            firstSwitch.Update(gameTime, ks, darwin);
            secondSwitch.Update(gameTime, ks, darwin);

            brain.Update(gameTime, ks, darwin);

            checkForSwitchToLevelFour();
            //checkForGameWin();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Beispiel #3
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);
            updateKeyHeldDown(ks);

            if (darwin.isDarwinAlive())
            {
                foreach (Flame flame in flames)
                {
                    this.checkForFlameDeath(flame, darwin);
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);
            potion.Update(gameTime, ks, darwin, zTime);

            foreach (Box b in boxes)
            {
                b.Update(gameTime, ks, darwin);
            }

            foreach (Vortex v in vortexes)
            {
                v.Update(gameTime, ks);
                // maybe update this so that boxes can't go in holes
                foreach (Box b in boxes)
                {
                    v.CollisionWithBO(b, board);
                }
            }

            northZombie.Update(darwin);
            southZombie.Update(darwin);
            eastZombie.Update(darwin);
            westZombie.Update(darwin);

            if (!darwin.isZombie())
            {
                if (!northZombie.isPatrolling())
                {
                    if (darwin.X == northZombie.X)
                    {
                        flames.AddLast(new Flame(board, northZombie.X, northZombie.Y + 1));
                        flames.AddLast(new Flame(board, northZombie.X, northZombie.Y + 2));
                        flames.AddLast(new Flame(board, northZombie.X, northZombie.Y + 3));
                        northZombie.doFlameSound();
                    }
                }
                else if (!southZombie.isPatrolling())
                {
                    if (darwin.X == southZombie.X)
                    {
                        flames.AddLast(new Flame(board, southZombie.X, southZombie.Y - 1));
                        flames.AddLast(new Flame(board, southZombie.X, southZombie.Y - 2));
                        flames.AddLast(new Flame(board, southZombie.X, southZombie.Y - 3));
                        southZombie.doFlameSound();
                    }
                }
                else if (!eastZombie.isPatrolling())
                {
                    if (darwin.Y == eastZombie.Y)
                    {
                        flames.AddLast(new Flame(board, eastZombie.X - 1, eastZombie.Y));
                        flames.AddLast(new Flame(board, eastZombie.X - 2, eastZombie.Y));
                        flames.AddLast(new Flame(board, eastZombie.X - 3, eastZombie.Y));
                        eastZombie.doFlameSound();
                    }
                }
                else if (!westZombie.isPatrolling())
                {
                    if (darwin.Y == westZombie.Y)
                    {
                        flames.AddLast(new Flame(board, westZombie.X + 1, westZombie.Y));
                        flames.AddLast(new Flame(board, westZombie.X + 2, westZombie.Y));
                        flames.AddLast(new Flame(board, westZombie.X + 3, westZombie.Y));
                        westZombie.doFlameSound();
                    }
                }
            }


            foreach (Flame flame in flames)
            {
                flame.Update();

                if (!flame.isAlive())
                {
                    //flames.Remove(flame);
                }
            }

            if (darwin.isDarwinAlive())
            {
                if (snake.isZombieAlive())
                {
                    updateSnakeCollision(snake, darwin, gameTime);
                }
                if (snake2.isZombieAlive())
                {
                    updateSnakeCollision(snake2, darwin, gameTime);
                }
                if (snake3.isZombieAlive())
                {
                    updateSnakeCollision(snake3, darwin, gameTime);
                }
                if (snake4.isZombieAlive())
                {
                    updateSnakeCollision(snake4, darwin, gameTime);
                }
            }

            foreach (Vortex v in vortexes)
            {
                if (darwin.isOnTop(v))
                {
                    fellDownPit = true;
                    gameOver    = true;
                }
            }

            checkForGameWin();
            checkForSwitchToLevelSix();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Beispiel #4
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            // only check for deaths if neccessary
            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    checkForGameOver(firstZombie);
                    checkForGameOver(secondZombie);
                    checkForGameOver(thirdZombie);
                    checkForGameOver(fourthZombie);
                    checkForGameOver(fifthZombie);
                    checkForGameOver(sixthZombie);
                }
                checkForGameOver(vortex);

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);

            firstZombie.Update(gameTime, darwin, brain);
            secondZombie.Update(gameTime, darwin, brain);
            thirdZombie.Update(gameTime, darwin, brain);
            fourthZombie.Update(gameTime, darwin, brain);
            fifthZombie.Update(gameTime, darwin, brain);
            sixthZombie.Update(gameTime, darwin, brain);

            firstSwitch.Update(gameTime, ks, darwin);

            brain.Update(gameTime, ks, darwin);

            vortex.Update(gameTime, ks);
            vortex.CollisionWithZombie(firstZombie);
            vortex.CollisionWithZombie(secondZombie);
            vortex.CollisionWithZombie(thirdZombie);
            vortex.CollisionWithZombie(fourthZombie);
            vortex.CollisionWithZombie(fifthZombie);
            vortex.CollisionWithZombie(sixthZombie);
            vortex.CollisionWithBO(brain, board);

            potion.Update(gameTime, ks, darwin, zTime);

            //checkForGameWin();
            checkForSwitchToLevelTwo();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }
Beispiel #5
0
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            // only check for deaths if neccessary
            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    if (firstZombie.isZombieAlive())
                    {
                        checkForGameOver(firstZombie);
                    }
                    if (secondZombie.isZombieAlive())
                    {
                        checkForGameOver(secondZombie);
                    }
                    if (thirdZombie.isZombieAlive())
                    {
                        checkForGameOver(thirdZombie);
                    }
                    if (fourthZombie.isZombieAlive())
                    {
                        checkForGameOver(fourthZombie);
                    }
                }
                if (darwin.isZombie())
                {
                    checkForGameOver(cannibalZombie);
                }

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);

            firstZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            firstZombie.Update(gameTime, darwin);

            secondZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            secondZombie.Update(gameTime, darwin);

            thirdZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            thirdZombie.Update(gameTime, darwin);

            fourthZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            fourthZombie.Update(gameTime, darwin);

            cannibalZombie.setPictureSize(board.getSquareWidth(), board.getSquareLength());
            cannibalZombie.Update(gameTime, darwin);

            potion.Update(gameTime, ks, darwin, zTime);

            //checkForGameWin();
            if (isAllZombiesDead())
            {
                foreach (BasicObject bo in removableWalls)
                {
                    if (!board.isGridPositionOpen(bo))
                    {
                        board.setGridPositionOpen(bo);
                    }
                }
                if (playSound)
                {
                    revealSound.Play();
                    playSound = false;
                }
            }

            checkUpdateToLevelThree();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }