Esempio n. 1
0
        public void Update(GameTime gameTime)
        {
            switch (gameState.getState())
            {
            case GameState.state.Start:
                UpdateStartState();
                break;

            case GameState.state.Level:
                if (!messageMode && !gameOver)
                {
                    UpdateLevelState(gameTime);
                }
                else if (messageMode)
                {
                    UpdateMessageMode();
                }
                else
                {
                    if (playDeathSound)
                    {
                        deathScreamSound.Play();
                        playDeathSound = false;
                    }

                    // for freezing screen when darwin dies
                    darwin.setDarwinDead();
                    darwin.setZombie();
                    UpdateLevelState(gameTime);
                    gameOverCounter++;
                    if (gameOverCounter > 200)
                    {
                        gameState.setState(GameState.state.End);
                        gameOverCounter = 0;
                    }
                }
                break;

            case GameState.state.End:
                UpdateEndState();
                break;
            }
        }
Esempio n. 2
0
        public void Update(GameTime gameTime)
        {
            switch (gameState.getState())
            {
            case GameState.state.Start:
                UpdateStartState();
                break;

            case GameState.state.Level:
                if (!messageMode && !gameOver)
                {
                    UpdateLevelState(gameTime);
                }
                else if (messageMode)
                {
                    UpdateMessageMode();
                }
                else
                {
                    // death logic is here, freezes screen plays animation
                    if (playDeathSound)
                    {
                        deathScreamSound.Play();
                        playDeathSound = false;
                    }

                    darwin.setDarwinDead();
                    darwin.setZombie();
                    UpdateLevelState(gameTime);
                    gameOverCounter++;
                    if (gameOverCounter > 200)
                    {
                        gameState.setState(GameState.state.End);
                        gameOverCounter = 0;
                    }
                }
                break;

            case GameState.state.End:
                UpdateEndState();
                break;
            }
        }
Esempio n. 3
0
        //protected override void UnloadContent() { }

        public void Update(GameTime gameTime)
        {
            switch (gameState.getState())
            {
            case GameState.state.Start:
                UpdateStartState();
                break;

            case GameState.state.Start2:
                UpdateStartState2();
                break;

            case GameState.state.Level:
                // decide if screen should be played normally or frozen for death animation or messages
                if (!messageMode && !gameOver)
                {
                    UpdateLevelState(gameTime);
                }
                else if (messageMode)
                {
                    UpdateMessageMode();
                }
                else
                {
                    if (playDeathSound)
                    {
                        if (fellDownPit)
                        {
                            fallScreamSound.Play();
                        }
                        else
                        {
                            deathScreamSound.Play();
                        }

                        playDeathSound = false;
                    }

                    // for changing darwin's sprite when he falls into the vortex
                    fellDownCounter++;
                    if (fellDownPit && darwin.destination.Width > 0 && darwin.destination.Height > 0 && fellDownCounter > 5)
                    {
                        darwin.destination.Width  -= (int)((float)board.getSquareWidth() * 0.1);
                        darwin.destination.Height -= (int)((float)board.getSquareLength() * 0.1);
                        fellDownCounter            = 0;
                    }

                    // kill darwin
                    darwin.setDarwinDead();
                    darwin.setZombie();
                    UpdateLevelState(gameTime);
                    gameOverCounter++;
                    if (gameOverCounter > 200)
                    {
                        gameState.setState(GameState.state.End);
                        gameOverCounter = 0;
                    }
                }
                break;

            case GameState.state.End:
                UpdateEndState();
                break;
            }
        }