Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            player.Update(gameTime);
            foreach (Obstacle obstacle in obs)
            {
                if (player.IsTouchingDown(obstacle))
                {
                    _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
                }
                if (player.IsTouchingTop(obstacle))
                {
                    _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
                }
                if (player.IsTouchingRight(obstacle))
                {
                    _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
                }
                if (player.IsTouchingLeft(obstacle))
                {
                    _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
                }
            }
            if (player.IsTouchingTop(bottom))
            {
                _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
            }
            if (player.IsTouchingDown(top))
            {
                _game.ChangeState(new Endgame(_game, _graphicsDevice, _contentManager, score));
            }

            Spawn();
            Move(gameTime);
            Delete();
            passedTime += 0.01f;
            if (spawnTime > 2f)
            {
                spawnTime -= 0.0005f;
            }
            if (score > checkPoint)
            {
                Obstacle.speed += 0.3f;
                checkPoint     += checkPoint;
            }

            score += 0.05f;
        }