Пример #1
0
        public void GameoverUpdate(GameTime gametime)
        {
            foreach (var item in lava.BlokArray)
            {
                if (collidy.Update(player.CollisionRectangle, item.CollisionRectangle))
                {
                    lava.resetTimer = 0;
                    lava.CreateWorld();
                    player.position = player.originalPosition;

                    if (gametime.TotalGameTime.Seconds - previousTime >= 1)
                    {
                        player.lives--;
                        previousTime = gametime.TotalGameTime.Seconds;
                    }
                    if (player.lives == 0)
                    {
                        player.lives = 3;
                        for (int x = 0; x < 14; x++)
                        {
                            for (int y = 0; y < 15; y++)
                            {
                                level.BlokArray[x, y] = null;
                            }
                        }

                        level.levelbinder.Level = 0;
                        level.CreateWorld();
                        player.position = player.originalPosition;
                    }
                }
            }
        }
Пример #2
0
        public void nextLevelUpdate()
        {
            foreach (var item in level.BlokArray)
            {
                Tile temptile = (Tile)collidy.ReturnCollision(player, (ICollidable)item);
                if (temptile != null && temptile.IsPortal)
                {
                    skip = true;
                }
            }

            if (skip)
            {
                for (int x = 0; x < 14; x++)
                {
                    for (int y = 0; y < 15; y++)
                    {
                        level.BlokArray[x, y] = null;
                    }
                }

                level.levelbinder.Level++;
                if (level.levelbinder.Level >= level.levelbinder.AllLevels.Count)
                {
                    stateChanger.ChangeState(new EndState(stateChanger, graphicsDevice, content));
                    goto end;
                }

                level.CreateWorld();
                lava.CreateWorld();
                player.position = player.originalPosition;
                skip            = false;
            }

            end :;
        }