Exemple #1
0
 public static void Draw(SpriteBatch spriteBatch)
 {
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].DrawOnTheBack(spriteBatch);
     TorchManager.Draw(spriteBatch);
     PlatformsManager.platformsRoomManagers[(int)currentRoom].Draw(spriteBatch);
     if (currentRoom == Rooms.finalBoss)
     {
         FinalBoss.Draw(spriteBatch);
     }
     else if (currentRoom == Rooms.midBoss)
     {
         MidBoss.Draw(spriteBatch);
     }
     EnemyManager.enemyRoomManagers[(int)currentRoom].Draw(spriteBatch);
     CollectablesManager.collectablesRoomManagers[(int)currentRoom].Draw(spriteBatch);
     ProjectilesManager.Draw(spriteBatch);
     Player.Draw(spriteBatch);
     MapsManager.maps[(int)currentRoom].Draw(spriteBatch);
     DoorsManager.doorsRoomManagers[(int)currentRoom].Draw(spriteBatch);
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].DrawInFront(spriteBatch);
     FireBallsManager.Draw(spriteBatch);
     LavaGeyserManager.Draw(spriteBatch);
     MonologuesManager.monologuesRoomManagers[(int)currentRoom].Draw(spriteBatch);
 }
Exemple #2
0
 public static void Update(float elapsedTime)
 {
     if (switchRoom())
         LoadSaveManager.SaveGameProgress();
     CameraManager.Update(elapsedTime);
     MapsManager.maps[(int)currentRoom].Update(elapsedTime);
     if (currentRoom== Rooms.finalBoss)
     {
         FinalBoss.Update(elapsedTime);
     }
     if(currentRoom==Rooms.midBoss)
     {
        MidBoss.Update(elapsedTime);
     }
     EnemyManager.enemyRoomManagers[(int)currentRoom].Update(elapsedTime);
     FireBallsManager.Update(elapsedTime);
     LavaGeyserManager.Update(elapsedTime);
     PlatformsManager.platformsRoomManagers[(int)currentRoom].Update(elapsedTime);
     CollectablesManager.collectablesRoomManagers[(int)currentRoom].Update(elapsedTime);
     MonologuesManager.monologuesRoomManagers[(int)currentRoom].Update(elapsedTime);
     DoorsManager.doorsRoomManagers[(int)currentRoom].Update();
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].Update(elapsedTime);
     TorchManager.Update(elapsedTime);
 }
Exemple #3
0
        //state machine managing the movement between rooms
        static bool switchRoom()
        {
            switch (currentRoom)
            {
                case Rooms.tutorial0:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial1
                        currentRoom = Rooms.tutorial1;
                        previousRoom = Rooms.tutorial0;
                        CameraManager.SwitchCamera(Rooms.tutorial1);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.tutorial0;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial1:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X + Player.width < 0)
                    {//move to tutorial0
                        currentRoom = Rooms.tutorial0;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial3
                        currentRoom = Rooms.tutorial3;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial3);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial2:
                    if (Player.position.Y+Player.height<0)
                    {
                        if (Player.position.X>= MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx)
                        {//move to tutorial3
                            currentRoom = Rooms.tutorial3;
                            previousRoom = Rooms.tutorial2;
                            CameraManager.SwitchCamera(Rooms.tutorial3);
                            Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                            Player.position.X -= MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else
                        {//move to tutorial1
                            currentRoom = Rooms.tutorial1;
                            previousRoom = Rooms.tutorial2;
                            CameraManager.SwitchCamera(Rooms.tutorial1);
                            Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                    }
                    else if (Player.position.X+Player.width<0)
                    {//moveto tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.tutorial2;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial3:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.X += MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx;
                        Player.position.Y = -10;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X<0)
                    {//move to tutorial1
                        currentRoom = Rooms.tutorial1;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.tutorial1);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.X = 0;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx- MapsManager.maps[(int)Rooms.tutorial3].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial4:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move to tutorial0
                        currentRoom = Rooms.tutorial0;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.tutorial0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to escape2
                        currentRoom = Rooms.escape2;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.escape2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchBellTower0:
                    if (Player.position.X+Player.width<0)
                    {//move to tutorial3
                        currentRoom = Rooms.tutorial3;
                        previousRoom = Rooms.churchBellTower0;
                        CameraManager.SwitchCamera(Rooms.tutorial3);
                        Player.position.X= MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move up to churchBellTower1
                        currentRoom = Rooms.churchBellTower1;
                        previousRoom = Rooms.churchBellTower0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower1);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {
                        if (Player.position.Y> 496)
                        {//move to churchGroundFloor0
                            currentRoom = Rooms.churchGroundFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.churchGroundFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else if (Player.position.Y>248)
                        {//church1stFloor0
                            currentRoom = Rooms.church1stFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.church1stFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx + MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else
                        {//church2ndFloor0
                            currentRoom = Rooms.church2ndFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.church2ndFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                                 + MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                                 + MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx
                                                 - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }

                    }
                    break;
                case Rooms.churchBellTower1:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.churchBellTower1;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y + Player.height < 0)
                    {//move up to chirchBellTower2
                        currentRoom = Rooms.churchBellTower2;
                        previousRoom = Rooms.churchBellTower1;
                        CameraManager.SwitchCamera(Rooms.churchBellTower2);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchBellTower2:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower1
                        currentRoom = Rooms.churchBellTower1;
                        previousRoom = Rooms.churchBellTower2;
                        CameraManager.SwitchCamera(Rooms.churchBellTower1);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y + Player.height < 0)
                    {//move up to midBoss
                        currentRoom = Rooms.midBoss;
                        previousRoom = Rooms.churchBellTower2;
                        CameraManager.SwitchCamera(Rooms.midBoss);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.midBoss:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower1
                        currentRoom = Rooms.churchBellTower2;
                        previousRoom = Rooms.midBoss;
                        CameraManager.SwitchCamera(Rooms.churchBellTower2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchGroundFloor0:
                    if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.churchGroundFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.churchGroundFloor0;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchAltarRoom:
                    if (Player.position.X+Player.width<0)
                    {//move to churchGroundFloor0
                        currentRoom = Rooms.churchGroundFloor0;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.churchGroundFloor0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move to church1stFloor0
                        currentRoom = Rooms.church1stFloor0;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.church1stFloor0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        Player.position.X += MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to descent
                        currentRoom = Rooms.descent;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.descent);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.church1stFloor0:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.Y = 0;
                        Player.position.X -= MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y +Player.height <0)
                    {//move to church2ndFloor0
                        currentRoom = Rooms.church2ndFloor0;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.church2ndFloor0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx;
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.church2ndFloor0:
                    if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.church2ndFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx
                                             -MapsManager.maps[(int)Rooms.church2ndFloor0].RoomHeightPx;
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to church1stFloor0
                        currentRoom = Rooms.church1stFloor0;
                        previousRoom = Rooms.church2ndFloor0;
                        CameraManager.SwitchCamera(Rooms.church1stFloor0);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.descent:
                    if (Player.position.Y+Player.height<0)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.descent;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to finalBoss
                        currentRoom = Rooms.finalBoss;
                        previousRoom = Rooms.descent;
                        Game1.Zoom0Dot5();
                        CameraManager.SwitchCamera(Rooms.finalBoss);
                        Player.position.Y = 0;
                        Player.position.X += MapsManager.maps[(int)currentRoom].RoomWidthtPx - MapsManager.maps[(int)Rooms.descent].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.finalBoss:
                    if (Player.position.X+Player.width<0)
                    {//move to escape0
                        currentRoom = Rooms.escape0;
                        previousRoom = Rooms.finalBoss;
                        Game1.Zoom1();
                        CameraManager.SwitchCamera(Rooms.escape0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if(Player.position.Y+Player.height<0) 
                    {//move to descent
                        currentRoom = Rooms.descent;
                        previousRoom = Rooms.finalBoss;
                        Game1.Zoom1();
                        CameraManager.SwitchCamera(Rooms.descent);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        Player.position.X += MapsManager.maps[(int)currentRoom].RoomWidthtPx - MapsManager.maps[(int)Rooms.finalBoss].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape0:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to finalBoss
                        currentRoom = Rooms.finalBoss;
                        previousRoom = Rooms.escape0;
                        Game1.Zoom0Dot5();
                        CameraManager.SwitchCamera(Rooms.finalBoss);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X + Player.width<0)
                    {//move to escape1
                        currentRoom = Rooms.escape1;
                        previousRoom = Rooms.escape0;
                        CameraManager.SwitchCamera(Rooms.escape1);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)Rooms.descent].RoomHeightPx - MapsManager.maps[(int)Rooms.tutorial2].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape1:
                    if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to escape0
                        currentRoom = Rooms.escape0;
                        previousRoom = Rooms.escape1;
                        CameraManager.SwitchCamera(Rooms.escape0);
                        Player.position.X = 0;
                        Player.position.Y-= MapsManager.maps[(int)Rooms.descent].RoomHeightPx - MapsManager.maps[(int)Rooms.tutorial2].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X+Player.width<0)
                    {//move to escape2
                        currentRoom = Rooms.escape2;
                        previousRoom = Rooms.escape1;
                        CameraManager.SwitchCamera(Rooms.escape2);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape2:
                    if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to escape1
                        currentRoom = Rooms.escape1;
                        previousRoom = Rooms.escape2;
                        CameraManager.SwitchCamera(Rooms.escape1);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if(Player.position.Y+Player.height<0)
                    {//move to tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.escape2;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
            }
            return false;
        }
Exemple #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

#if LEVEL_EDITOR
            MapsManager.Inizialize(Content.Load <Texture2D>("tiles"));
            CameraManager.Inizialize
            (
                new Texture2D[(int)RoomsManager.Rooms.total]
            {
                Content.Load <Texture2D>(@"backgrounds\tutorial0"),
                Content.Load <Texture2D>(@"backgrounds\tutorial1"),
                Content.Load <Texture2D>(@"backgrounds\tutorial2"),
                Content.Load <Texture2D>(@"backgrounds\tutorial3"),
                Content.Load <Texture2D>(@"backgrounds\tutorial4"),
                Content.Load <Texture2D>(@"backgrounds\bellTower0"),
                Content.Load <Texture2D>(@"backgrounds\bellTower1"),
                Content.Load <Texture2D>(@"backgrounds\bellTower2"),
                Content.Load <Texture2D>(@"backgrounds\midBoss"),
                Content.Load <Texture2D>(@"backgrounds\groundFloor"),
                Content.Load <Texture2D>(@"backgrounds\altarRoom"),
                Content.Load <Texture2D>(@"backgrounds\firstFloor"),
                Content.Load <Texture2D>(@"backgrounds\secondFloor"),
                Content.Load <Texture2D>(@"backgrounds\descent"),
                Content.Load <Texture2D>(@"backgrounds\finalBoss"),
                Content.Load <Texture2D>(@"backgrounds\escape0"),
                Content.Load <Texture2D>(@"backgrounds\escape1"),
                Content.Load <Texture2D>(@"backgrounds\escape2"),
            }
            );
            spriteFont = Content.Load <SpriteFont>(@"fonts\monologue");
            PlatformsManager.Inizialize(Content.Load <Texture2D>("platforms"));
            levelEditor = new LevelEditor(Content.Load <SpriteFont>(@"fonts\arial32"),
                                          Content.Load <SpriteFont>(@"fonts\arial14"),
                                          Content.Load <Texture2D>("whiteTile"));
#else
            //load the game assets here
            currentGameState = GameStates.titleScreen;
            LoadSaveManager.Inizialize();
            GameStats.Inizialize();
            Achievements.Initialize(Content.Load <SpriteFont>(@"fonts\monologue"),
                                    Content.Load <SpriteFont>(@"fonts\LiberationMono12"));
            MapsManager.Inizialize(Content.Load <Texture2D>("tiles"));
            CameraManager.Inizialize
            (
                new Texture2D[(int)RoomsManager.Rooms.total]
            {
                Content.Load <Texture2D>(@"backgrounds\tutorial0"),
                Content.Load <Texture2D>(@"backgrounds\tutorial1"),
                Content.Load <Texture2D>(@"backgrounds\tutorial2"),
                Content.Load <Texture2D>(@"backgrounds\tutorial3"),
                Content.Load <Texture2D>(@"backgrounds\tutorial4"),
                Content.Load <Texture2D>(@"backgrounds\bellTower0"),
                Content.Load <Texture2D>(@"backgrounds\bellTower1"),
                Content.Load <Texture2D>(@"backgrounds\bellTower2"),
                Content.Load <Texture2D>(@"backgrounds\midBoss"),
                Content.Load <Texture2D>(@"backgrounds\groundFloor"),
                Content.Load <Texture2D>(@"backgrounds\altarRoom"),
                Content.Load <Texture2D>(@"backgrounds\firstFloor"),
                Content.Load <Texture2D>(@"backgrounds\secondFloor"),
                Content.Load <Texture2D>(@"backgrounds\descent"),
                Content.Load <Texture2D>(@"backgrounds\finalBoss"),
                Content.Load <Texture2D>(@"backgrounds\escape0"),
                Content.Load <Texture2D>(@"backgrounds\escape1"),
                Content.Load <Texture2D>(@"backgrounds\escape2"),
            }
            );
            PlatformsManager.Inizialize(Content.Load <Texture2D>("platforms"));
            ProjectilesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            Player.Inizialize(Content.Load <Texture2D>(@"characters\player"), new Vector2(16, 185));
            RoomsManager.Inizialize();
            GameEvents.Inizialize();
            FireBallsManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            LavaGeyserManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            EnemyManager.Initialise(Content.Load <Texture2D>(@"characters\enemy1"), Content.Load <Texture2D>(@"characters\enemy2"));
            MidBoss.Initialise(Content.Load <Texture2D>(@"characters\midboss"));
            FinalBoss.Inizialize(Content.Load <Texture2D>(@"characters\finalBoss"),
                                 new Texture2D[] { Content.Load <Texture2D>(@"characters\stoneWing"),
                                                   Content.Load <Texture2D>(@"characters\healthyWing"),
                                                   Content.Load <Texture2D>(@"characters\damagedWing"),
                                                   Content.Load <Texture2D>(@"characters\deadWing") });
            CollectablesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            MonologuesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"),
                                         Content.Load <SpriteFont>(@"fonts\monologue"));
            DoorsManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            AnimatedSpritesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            TorchManager.Initialize(Content.Load <Texture2D>("firePot"));
            PlayerDeathManager.Initialize(Content.Load <Texture2D>(@"menus\deathScreen"),
                                          Content.Load <Texture2D>(@"menus\menuOptions"));
            MenusManager.Initialize(Content.Load <Texture2D>(@"menus\menuOptions"),
                                    new Texture2D[]
            {
                Content.Load <Texture2D>(@"menus\titleScreen"),
                Content.Load <Texture2D>(@"menus\controls"),
                Content.Load <Texture2D>(@"menus\credits"),
                Content.Load <Texture2D>(@"menus\pause"),
                Content.Load <Texture2D>(@"menus\quit"),
                Content.Load <Texture2D>(@"menus\doubleJump"),
                Content.Load <Texture2D>(@"menus\wallJump"),
                Content.Load <Texture2D>(@"menus\achievements"),
            });
            CutscenesManager.Initialize(Content.Load <Texture2D>(@"characters\enemy1"),
                                        Content.Load <Texture2D>(@"characters\player"),
                                        Content.Load <SpriteFont>(@"fonts\monologue"));
            SoundEffects.Initialise
            (
                //Player Sound Effects
                Content.Load <SoundEffect>(@"sounds\pJump"),
                Content.Load <SoundEffect>(@"sounds\pShoot"),
                Content.Load <SoundEffect>(@"sounds\pHurt"),
                Content.Load <SoundEffect>(@"sounds\pickup"),

                //Enemy Sound Effects
                Content.Load <SoundEffect>(@"sounds\enemyAttack"),
                Content.Load <SoundEffect>(@"sounds\enemyHurt"),
                Content.Load <SoundEffect>(@"sounds\e2Attack"),

                //Midboss Sound Effects
                Content.Load <SoundEffect>(@"sounds\midMove"),
                Content.Load <SoundEffect>(@"sounds\midAttack"),
                Content.Load <SoundEffect>(@"sounds\midHurt"),

                Content.Load <SoundEffect>(@"sounds\finAttack"),
                Content.Load <SoundEffect>(@"sounds\finHurt"),
                Content.Load <SoundEffect>(@"sounds\finAwaken"),
                Content.Load <SoundEffect>(@"sounds\finRecover"),
                Content.Load <Song>(@"sounds\finalBossMusic")
            );
            gameInitialized = true;
            Zoom1();
#endif
        }
Exemple #5
0
        public static void ResetVariables()
        {//reposition the player and reset some classes to their intial state
            Player.IsOnMovingPlatform = false;
            elapsedTimeBeforeResuming = 0;
            Game1.currentGameState    = Game1.GameStates.playing;
            CameraManager.Reset();
            LavaGeyserManager.Reset();
            FireBallsManager.Reset();
            ProjectilesManager.Reset();
            EnemyManager.Reset();
            if (!MidBoss.Dead)
            {
                MidBoss.Reset();
            }
            CollectablesManager.ResetHearts();
            GameEvents.Reset();
            switch (RoomsManager.CurrentRoom)
            {
            case RoomsManager.Rooms.tutorial0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial4)
                {
                    Player.position = new Vector2(152, 192);
                }
                else if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial1)
                {
                    Player.position = new Vector2(903, 185);
                }
                else
                {
                    Player.position = new Vector2(152, 150);
                }
                break;

            case RoomsManager.Rooms.tutorial1:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial0)
                {
                    Player.position = new Vector2(18, 185);
                }
                else
                {
                    Player.position = new Vector2(550, 193);
                }
                break;

            case RoomsManager.Rooms.tutorial2:
                if (Player.position.Y < 80 && RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial1 &&
                    (Player.position.X < 366 || Player.position.X > 426))
                {
                    RoomsManager.CurrentRoom  = RoomsManager.Rooms.tutorial1;
                    RoomsManager.PreviousRoom = RoomsManager.Rooms.tutorial0;
                    CameraManager.SwitchCamera(RoomsManager.Rooms.tutorial1);
                    Player.position = new Vector2(18, 185);
                }
                else
                {
                    Player.position = new Vector2(388, 153);
                }
                break;

            case RoomsManager.Rooms.tutorial3:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(776, 193);
                }
                else
                {
                    Player.position = new Vector2(91, 193);
                }
                break;

            case RoomsManager.Rooms.tutorial4:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape2)
                {
                    Player.position = new Vector2(64, 153);
                }
                else
                {
                    Player.position = new Vector2(166, 153);
                }
                break;

            case RoomsManager.Rooms.churchBellTower0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower1)
                {
                    if (Player.position.X < 436 && Player.position.X >= 60)
                    {
                        Player.position = new Vector2(405, 161);
                    }
                    else if (Player.position.X >= 436)
                    {
                        Player.position = new Vector2(456, 961);
                    }
                    else
                    {
                        Player.position = new Vector2(23, 961);
                    }
                }
                else if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial3)
                {
                    Player.position = new Vector2(23, 961);
                }
                else
                {
                    Player.position = new Vector2(456, 961);
                }
                break;

            case RoomsManager.Rooms.churchBellTower1:
                if (Player.position.X >= 436)
                {
                    Player.position = new Vector2(458, 1097);
                }
                else if (Player.position.X < 60)
                {
                    Player.position = new Vector2(23, 1097);
                }
                else
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                    {
                        Player.position = new Vector2(372, 1097);
                    }
                    else
                    {
                        Player.position = new Vector2(111, 121);
                    }
                }
                break;

            case RoomsManager.Rooms.churchBellTower2:
                if (Player.position.X >= 436 && Player.position.Y > 110)
                {
                    Player.position = new Vector2(464, 1177);
                }
                else if (Player.position.X >= 60)
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower1)
                    {
                        Player.position = new Vector2(119, 1177);
                    }
                    else
                    {
                        Player.position = new Vector2(457, 65);
                    }
                }
                else
                {
                    Player.position = new Vector2(23, 1177);
                }
                break;

            case RoomsManager.Rooms.midBoss:
                Player.position = new Vector2(452, 25);
                break;

            case RoomsManager.Rooms.churchGroundFloor0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(22, 465);
                }
                else
                {
                    Player.position = new Vector2(1160, 465);
                }
                break;

            case RoomsManager.Rooms.churchAltarRoom:
                if (Player.position.X < 104)
                {
                    Player.position = new Vector2(22, 465);
                }
                else
                {
                    Player.position = new Vector2(250, 465);
                }
                break;

            case RoomsManager.Rooms.church1stFloor0:
                if (Player.position.X < 1288)
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchAltarRoom)
                    {
                        Player.position = new Vector2(1208, 217);
                    }
                    else
                    {
                        Player.position = new Vector2(18, 217);
                    }
                }
                else
                {
                    Player.position = new Vector2(1320, 217);
                }
                break;

            case RoomsManager.Rooms.church2ndFloor0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(37, 481);
                }
                else
                {
                    Player.position = new Vector2(1289, 481);
                }
                break;

            case RoomsManager.Rooms.descent:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchAltarRoom)
                {
                    Player.position = new Vector2(339, 121);
                }
                else
                {
                    Player.position = new Vector2(318, 233);
                }
                break;

            case RoomsManager.Rooms.finalBoss:
                Game1.Zoom0Dot5();
                MediaPlayer.Stop();
                if (!FinalBoss.Dead)
                {
                    Player.position = new Vector2(734, 41);
                }
                else
                {
                    Player.position = new Vector2(17, 41);
                }
                break;

            case RoomsManager.Rooms.escape0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.finalBoss)
                {
                    Player.position = new Vector2(1726, 129);
                }
                else
                {
                    Player.position = new Vector2(18, 49);
                }
                break;

            case RoomsManager.Rooms.escape1:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape0)
                {
                    Player.position = new Vector2(1320, 89);
                }
                else
                {
                    Player.position = new Vector2(12, 289);
                }
                break;

            case RoomsManager.Rooms.escape2:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape1)
                {
                    Player.position = new Vector2(500, 289);
                }
                else
                {
                    Player.position = new Vector2(21, 129);
                }
                break;
            }
        }
Exemple #6
0
        public static void Update(float elapsedTime)
        {
            if (dead || bossAnimation == BossAnimations.stone)
            {
                return; //do not update if boss is dead
            }
            if (bossAnimation != BossAnimations.stone &&
                bossAnimation != BossAnimations.stoneToIdle &&
                bossAnimation != BossAnimations.falling)
            { //oscillatory motion
                bossMidPoint.Y += YSpeed;
                YSpeed         += (bossInitialMidPoint.Y - bossMidPoint.Y) * 0.2f * elapsedTime;
            }
            bossAnimations[(int)bossAnimation].Update(elapsedTime);
            rightWingAnimations[(int)rightWingAnimation].Update(elapsedTime);
            leftWingAnimations[(int)leftWingAnimation].Update(elapsedTime);
            if (!bossAnimations[(int)bossAnimation].Active)
            {//if an animation has stopped playing because the last frame was reached
             //decide what animation should be played next
                if (bossAnimation == BossAnimations.startRecovering)
                {
                    bossAnimation      = BossAnimations.recovering;
                    rightWingAnimation = WingAnimations.flap;
                    leftWingAnimation  = WingAnimations.flap;
                    bossAnimations[(int)bossAnimation].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
                else
                {
                    bossAnimation      = BossAnimations.idle;
                    rightWingAnimation = WingAnimations.idle;
                    leftWingAnimation  = WingAnimations.idle;
                    if (rightWingTexture == WingTextures.stone || leftWingTexture == WingTextures.stone)
                    {
                        rightWingTexture = WingTextures.healthy;
                        leftWingTexture  = WingTextures.healthy;
                    }
                    bossAnimations[(int)bossAnimation].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
            }
            //finate state machine determing the boss AI
            switch (bossAnimation)
            {
            case BossAnimations.stone:
                break;

            case BossAnimations.stoneToIdle:
                break;

            case BossAnimations.idle:     //if the boss is in th eidle state, then it is ready to attack
                                          //the attacks available depend on the phace of the battle
                                          //the battle progresses to the next phase each time a wing is hit
                if (!bossAnimations[(int)bossAnimation].IsLastFrame())
                {
                    break;
                }
                switch (currentPhase)
                {
                case Phases.one:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(4);
                    if (attack == 0)
                    {
                        FireBallsManager.ThrowAtPlayer((int)MathHelper.Lerp(3, 6, 1 - (float)bossHP / maxBossHp), 2 + (float)rand.NextDouble(), 1f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        FireBallsManager.ThrowInAllDirections((int)MathHelper.Lerp(3, 7, 1 - (float)bossHP / maxBossHp), FireBall.radialShootingVelocity, (float)(0.5 + rand.NextDouble()));
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 2)
                    {
                        int   num       = (int)MathHelper.Lerp(2, 4, 1 - (float)bossHP / maxBossHp);
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 2);
                        FireBallsManager.AddGhostFireball(7);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        FireBallsManager.Sweep((float)(0.4 + 0.2 * rand.NextDouble()), rand.Next(3, 5));
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.two:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(3);
                    if (attack == 0)
                    {
                        attack = rand.Next(2);
                        if (attack == 0)
                        {
                            FireBallsManager.ThrowAtPlayer((int)MathHelper.Lerp(4, 9, 1 - (float)bossHP / maxBossHp), (float)(3 + rand.NextDouble()), 1f);
                        }
                        else
                        {
                            FireBallsManager.ThrowInAllDirections(6, FireBall.radialShootingVelocity, (float)(1 + rand.NextDouble()));
                        }
                        int   num       = (int)MathHelper.Lerp(2, 4, 1 - (float)bossHP / maxBossHp);
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 2);
                        FireBallsManager.AddGhostFireball(7);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        float angle = MathHelper.Lerp(90, 180, 1 - (float)bossHP / maxBossHp);
                        FireBallsManager.TrowWithinCircularSector(
                            (int)(angle / 6),
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.25 + 0.5 * rand.NextDouble()),
                            angle);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        FireBallsManager.RandomSweep((float)(1.0f + 0.2 * rand.NextDouble()), 2, 4);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.three:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(4);
                    if (attack == 0)
                    {
                        attack = rand.Next(2);
                        if (attack == 0)
                        {
                            int   num       = 2;
                            int[] platforms = new int[num];
                            for (int i = 0; i < num; i++)
                            {
                                int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                                while (platforms.Contains(nextPlatform))
                                {
                                    nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                                }
                                platforms[i] = nextPlatform;
                            }
                            FireBallsManager.TargetPlatform(platforms, 6, 2);
                            FireBallsManager.AddGhostFireball(7);
                        }
                        else
                        {
                            FireBallsManager.ThrowAtPlayer(4, (float)(3 + rand.NextDouble()), 1f);
                        }
                        LavaGeyserManager.ShootGeyser(
                            new float[] { rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200),
                                          rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200), },
                            3);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        int   num       = 3;
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 5);
                        FireBallsManager.TrowWithinCircularSector(
                            20,
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.5 + 0.1 * rand.NextDouble()),
                            120);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 2)
                    {
                        FireBallsManager.Spiral(30, 20, MathHelper.Lerp(0.3f, 0.5f, (float)bossHP / maxBossHp), FireBall.radialShootingVelocity * 0.4f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        LavaGeyserManager.EquallySpaced(LavaGeyser.size * 7, 2, 0);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.four:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(3);
                    if (attack == 0)
                    {
                        FireBallsManager.Sweep((float)(0.4 + 0.2 * rand.NextDouble()), 10);
                        LavaGeyserManager.SweepAcross(
                            1,
                            0.5f,
                            (int)MathHelper.Lerp(4, 10, (float)bossHP / maxBossHp),
                            244,
                            524,
                            rand.Next(2) == 0);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        FireBallsManager.TrowWithinCircularSector(
                            (int)(20),
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.25 + 0.5 * rand.NextDouble()),
                            120);
                        LavaGeyserManager.EquallySpaced(LavaGeyser.size * 6, 2, LavaGeyser.size * 6 * (float)rand.NextDouble());
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        LavaGeyserManager.ShootGeyser(
                            new float[] { rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200),
                                          rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200), },
                            3);
                        FireBallsManager.Spiral(30, 20, 0.3f, FireBall.radialShootingVelocity * 0.4f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }

                    SoundEffects.FinalBossAttack.Play();
                    break;
                }
                }
                break;

            case BossAnimations.attack:     //the boss is attacking
                elapsedAttackAnimationTime += elapsedTime;
                if (elapsedAttackAnimationTime >= attackAnimationTime)
                {
                    elapsedAttackAnimationTime = 0;
                    bossAnimation = BossAnimations.idle;
                    bossAnimations[(int)BossAnimations.idle].Reset();
                    bossAnimations[(int)BossAnimations.endRecovering].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
                break;

            case BossAnimations.startRecovering:
                break;

            case BossAnimations.recovering:     //the boss is recovering and its wings can be hit
            {
                if (bossAnimations[(int)bossAnimation].FrameIndex == 0 &&
                    bossAnimations[(int)bossAnimation].FreviousFrameIndex != 0)
                {
                    SoundEffects.FinalBossRecover.Play();
                }
                else if (bossAnimations[(int)bossAnimation].FrameIndex == 2 &&
                         bossAnimations[(int)bossAnimation].FreviousFrameIndex != 2)
                {
                    SoundEffects.FinalBossAwaken.Play();
                }
                elapsedRecoveryTime += elapsedTime;
                if (elapsedRecoveryTime >= recoveryTime)
                {
                    bossAnimation = BossAnimations.endRecovering;
                    if (rightWingHP > 0)
                    {
                        rightWingAnimation = WingAnimations.withdraw;
                    }
                    else
                    {
                        rightWingAnimation = WingAnimations.withdrawDead;
                    }
                    if (leftWingHP > 0)
                    {
                        leftWingAnimation = WingAnimations.withdraw;
                    }
                    else
                    {
                        leftWingAnimation = WingAnimations.withdrawDead;
                    }
                    bossAnimations[(int)BossAnimations.endRecovering].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                    elapsedRecoveryTime = 0;
                    bossHP = maxBossHp / 2;
                    break;
                }
                switch (currentPhase)
                {
                case Phases.one:
                    if (rightWingHP + leftWingHP == 3)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.two;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.AddGhostFireball(3);
                    }
                    break;

                case Phases.two:
                    if (rightWingHP + leftWingHP == 2)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.three;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.ThrowAtPlayer(20, 2, 0.1f);
                        CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                            new Collectable(new Point(374, 475), Collectable.ItemType.heart));
                    }
                    break;

                case Phases.three:
                    if (rightWingHP + leftWingHP == 1)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.four;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        LavaGeyserManager.SweepAcross(1, 0f, 100, 159, 609, true);
                        CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                            new Collectable(new Point(378, 475), Collectable.ItemType.heart));
                    }
                    break;

                case Phases.four:
                    if (rightWingHP + leftWingHP == 0)
                    {
                        if (Player.CollisionRectangle.Right > bossMidPoint.X)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                            leftWingAnimation  = WingAnimations.withdrawDead;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                            leftWingAnimation  = WingAnimations.withdraw;
                        }
                        bossAnimation = BossAnimations.falling;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        elapsedRecoveryTime = 0;
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                    }
                    break;
                }
                break;
            }

            case BossAnimations.endRecovering:
                break;

            case BossAnimations.falling:     //when the boss dies, it falls out of the screen
            {
                bossMidPoint.Y += YSpeed * elapsedTime;
                YSpeed         += Gravity.gravityAcceleration * elapsedTime;
                if (BossDrawRectangle.Y > MapsManager.maps[(int)RoomsManager.CurrentRoom].RoomHeightPx)
                {
                    dead = true;
                    LoadSaveManager.SaveGameProgress();
                    MediaPlayer.Stop();
                }
                break;
            }
            }
        }