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); }
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); }
/// <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 }
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; } }