Beispiel #1
0
        public static void GoToNextLevel()
        {
            CurrentLevel++;

            HUDManager.setLevel(Levels[CurrentLevel]);

            // Copy the needed details cross to the next level
            // Set the Player1 to the same Player1 as the last level
            Levels[CurrentLevel].Player1 = Levels[CurrentLevel - 1].Player1;
            // Make sure the Player1 is in the new Actor's list
            Levels[CurrentLevel].Actors.Add(Levels[CurrentLevel].Player1);
            // Set player1's inLevel
            Levels[CurrentLevel].Player1.InLevel = Levels[CurrentLevel];

            // Reset Player1 Draw details
            Levels[CurrentLevel].Player1.ResetIdleGraphic();

            Levels[CurrentLevel].Player1.Health   = 300; // Maybe leave energy the same
            Levels[CurrentLevel].Player1.Position = new Vector2(-100, 440);
            Levels[CurrentLevel].Player1.SetIntro01TargetPosition(new Vector2(425, 520));
            Levels[CurrentLevel].Player1.State = PlayerState.Level01Intro;

            Levels[CurrentLevel].LevelState = LevelState.FadeIn;
            Camera.Position = new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2);

            if (CurrentLevel == 2) // If Level 2 play Lvl 2 music
            {
                MusicManager.StopSong();
                MusicManager.PlaySong("music02");
            }
        }
Beispiel #2
0
        public static void CreateLevels()
        {
            Levels.Clear();   // Removes all items from level, reset
            CurrentLevel = 0; // Reset GameManager's CurrentLevel to start a new game

            Level level;

            #region Level 01 - Outside of Jail

            level = new Level();

            Texture2D stage1BgBack     = TextureManager.GetTexure("Level01-bg");
            Texture2D stage1BgBackB    = TextureManager.GetTexure("Level01-bg2");
            Texture2D stage1BgMain     = TextureManager.GetTexure("Level01");
            Texture2D stage1BgMainB    = TextureManager.GetTexure("Level01-b");
            Texture2D stage1FgTreeBlur = TextureManager.GetTexure("TreeBlur");

            // Level 1 Backgrounds
            level.AddBackgroundItem(stage1BgBack, Vector2.Zero, 0.1f, 0.95f);
            level.AddBackgroundItem(stage1BgBackB, new Vector2(stage1BgBack.Width, 0), 0.1f, 0.95f);
            level.AddBackgroundItem(stage1BgMain, Vector2.Zero, 1f, 0.90f);
            level.AddBackgroundItem(stage1BgMainB, new Vector2(stage1BgMain.Width, 0), 1f, 0.90f);
            level.AddBackgroundItem(stage1FgTreeBlur, new Vector2(-274, 0), 1f, 0.1f);
            level.AddBackgroundItem(stage1FgTreeBlur, new Vector2(1476, 0), 1f, 0.1f);

            // Define Level 1 starting PlayBounds
            level.PlayBounds = new Rectangle(0, 480, Game1.SCREEN_WIDTH, 120);

            // Level 1 Actors
            level.Actors.Add(new Player(new Vector2(-150, 550),
                                        level, PlayerIndex.One));

            level.Player1           = level.Actors[level.Actors.Count - 1] as Player;
            level.Player1.FacingDir = DirectionTarget.Right;
            level.Player1.SetIntro01TargetPosition(new Vector2(270, 520));

            // Enemy
            AdonEnemy enemy_Adon;
            enemy_Adon = new AdonEnemy(new Vector2(650, 535), level);
            enemy_Adon.SetToWait(DirectionTarget.Left);
            level.Actors.Add(enemy_Adon);

            DeejayEnemy enemy;
            enemy = new DeejayEnemy(new Vector2(530, 500), level); // Laying Down Radio
            enemy.SetToLayingDown(DirectionTarget.Left);
            level.Actors.Add(enemy);

            enemy = new DeejayEnemy(new Vector2(710, 500), level); // Top
            enemy.SetToWait(DirectionTarget.Left);
            level.Actors.Add(enemy);

            enemy = new DeejayEnemy(new Vector2(710, 570), level); // Bottom
            enemy.SetToWait(DirectionTarget.Left);
            level.Actors.Add(enemy);

            /////////////////////////////////////////////////////////////////

            TrashCan tc = new TrashCan(level, new Vector2(30, 500),
                                       new PickUpStone(level, Vector2.Zero));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(90, 500),
                              new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(670, 500),
                              new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(710, 500),
                              new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc);

            // Section 2
            tc = new TrashCan(level, new Vector2(1000, 485),
                              new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(1060, 485),
                              new PickUpHealthPack(level, Vector2.Zero, 20));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(1450, 490),
                              new PickUpHealthPack(level, Vector2.Zero, 30));
            level.GameItems.Add(tc);

            // Section 3
            tc = new TrashCan(level, new Vector2(1940, 540),
                              new PickUpHealthPack(level, Vector2.Zero, 60));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(2460, 515),
                              new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc);
            tc = new TrashCan(level, new Vector2(2500, 515),
                              new PickUpHealthPack(level, Vector2.Zero, 10));
            level.GameItems.Add(tc);

            CreateLevel1CutScenes(level);

            Levels.Add(level);
            HUDManager.setLevel(level);

            Camera.Position = new Vector2(Game1.SCREEN_WIDTH / 2, Game1.SCREEN_HEIGHT / 2);

            #endregion

            #region Level 02 - Train Stattion

            level = new Level();

            Texture2D stage2BgBack = TextureManager.GetTexure("Level02-bg");
            Texture2D stage2BgMain = TextureManager.GetTexure("Level02");

            // Level 2 Backgrounds
            level.AddBackgroundItem(stage2BgBack, Vector2.Zero, 0.1f, 0.95f);
            level.AddBackgroundItem(stage2BgMain, Vector2.Zero, 1f, 0.90f);

            // Define Level 2 starting PlayBounds
            level.PlayBounds = new Rectangle(0, 480, Game1.SCREEN_WIDTH, 120);

            // Create 2 enemies to the waiting for the players

            enemy = new DeejayEnemy(new Vector2(550, 480), level);
            enemy.SetToWait(DirectionTarget.Left);
            level.Actors.Add(enemy);

            enemy = new DeejayEnemy(new Vector2(660, 570), level);
            enemy.SetToWait(DirectionTarget.Left);
            level.Actors.Add(enemy);

            enemy = new DeejayEnemy(new Vector2(150, 490), level);
            enemy.SetToWait(DirectionTarget.Right);
            level.Actors.Add(enemy);

            enemy = new DeejayEnemy(new Vector2(170, 580), level);
            enemy.SetToWait(DirectionTarget.Right);
            level.Actors.Add(enemy);

            // Trash Can
            TrashCan tc_Level02 = new TrashCan(level, new Vector2(640, 480),
                                               new PickUpStone(level, Vector2.Zero));
            level.GameItems.Add(tc_Level02);
            TrashCan tc2_Level02 = new TrashCan(level, new Vector2(580, 475),
                                                new PickUpHealthPack(level, Vector2.Zero, 40));
            level.GameItems.Add(tc2_Level02);

            CreateLevel2CutScenes(level);

            Levels.Add(level);

            #endregion
        }