public TestLevel(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content) { #region Textures var texture = _content.Load <Texture2D>("Square"); var playerTexture = _content.Load <Texture2D>("Video/Player/Player"); var chestTexture = _content.Load <Texture2D>("Video/Enemies/Chests/ChestSize"); _staticBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/StaticBackgroundNight"); _farBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/FarBackground"); _midBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/MidBackground"); _directBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/DirectBackground"); _frontBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/FrontBackground"); _frontBackgroundPosition = new Vector2(0, 0); _midBackgroundPosition = new Vector2(0, 0); _farBackgroundPosition = new Vector2(0, 0); #endregion #region Sound var backgroundMusic = _content.Load <Song>("Audio/Music/ThemeSong"); var levelSoundEffects = new List <SoundEffect>() { //_content.Load<SoundEffect>("BallHitsBat"), //_content.Load<SoundEffect>("BallHitsWall"), //_content.Load<SoundEffect>("PlayerScores"), }; var tileSoundEffects = new List <SoundEffect>() { //_content.Load<SoundEffect>("Sound/Tile/Break1"), //_content.Load<SoundEffect>("Sound/Tile/Break2"), }; var playerSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Player/FireWhirl"), // 0 _content.Load <SoundEffect>("Audio/Sound/Player/FastFall"), _content.Load <SoundEffect>("Audio/Sound/Player/Hurt1"), _content.Load <SoundEffect>("Audio/Sound/Player/Hurt2"), _content.Load <SoundEffect>("Audio/Sound/Player/Attack1"), _content.Load <SoundEffect>("Audio/Sound/Player/Attack2"), // 5 _content.Load <SoundEffect>("Audio/Sound/Player/Attack3"), _content.Load <SoundEffect>("Audio/Sound/Player/StopCast"), _content.Load <SoundEffect>("Audio/Sound/Player/GroundPound"), _content.Load <SoundEffect>("Audio/Sound/Player/Sprint"), _content.Load <SoundEffect>("Audio/Sound/Player/Jump1"), // 10 _content.Load <SoundEffect>("Audio/Sound/Player/Jump2"), _content.Load <SoundEffect>("Audio/Sound/Player/WallJump"), _content.Load <SoundEffect>("Audio/Sound/Player/Cast1"), _content.Load <SoundEffect>("Audio/Sound/Player/Cast2"), _content.Load <SoundEffect>("Audio/Sound/Player/Death"), // 15 _content.Load <SoundEffect>("Audio/Sound/Player/StopSprint"), _content.Load <SoundEffect>("Audio/Sound/Player/Walk"), _content.Load <SoundEffect>("Audio/Sound/Player/JumpPad"), _content.Load <SoundEffect>("Audio/Sound/Player/Respawn"), }; var tikiEnemySoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/FireWhirl"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/FastFall"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Hurt1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Hurt2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack3"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/StopCast"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/GroundPound"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Sprint"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Jump1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Jump2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/WallJump"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Cast1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Cast2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Death"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/StopSprint"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Walk"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Dart"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Spirit"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchCast"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchLaunch"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchFireLaunch"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/DartFire"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/SpiritFire"), }; var chestSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break3"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break4"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break5"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/BreakGreater"), }; var spellSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire1"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire2"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire3"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Spirit"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/SpiritHit"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney12"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney5"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney10"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney25"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectPowerUp"), }; _soundManager = new SoundManager(backgroundMusic, levelSoundEffects); //_soundManager.PlayMusic(); #endregion #region Hurtboxes var groundPound = _content.Load <Texture2D>("Video/Hurtboxes/GroundPound"); var fireWhirl = _content.Load <Texture2D>("Video/Effects/DefaultExplosion"); var shadowWhirl = _content.Load <Texture2D>("Video/Effects/DefaultExplosion"); var dart = _content.Load <Texture2D>("Square"); var torch = _content.Load <Texture2D>("Square"); var spirit = _content.Load <Texture2D>("Square"); var explosion = new Dictionary <string, Models.Animation>() { { "Explode", new Animation(_content.Load <Texture2D>("Video/Effects/DefaultExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Water", new Animation(_content.Load <Texture2D>("Video/Effects/WaterExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Fire", new Animation(_content.Load <Texture2D>("Video/Effects/FireExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Earth", new Animation(_content.Load <Texture2D>("Video/Effects/EarthExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Air", new Animation(_content.Load <Texture2D>("Video/Effects/AirExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Shadow", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosion"), 1) { FrameSpeed = 0.5f, } }, { "ShadowWhirl", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowWhirl"), 1) { FrameSpeed = 0.5f, } }, { "ShadowSmall", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "ShadowTiny", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosionTiny"), 1) { FrameSpeed = 0.5f, } }, { "WaterSmall", new Animation(_content.Load <Texture2D>("Video/Effects/WaterExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "FireSmall", new Animation(_content.Load <Texture2D>("Video/Effects/FireExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "EarthSmall", new Animation(_content.Load <Texture2D>("Video/Effects/EarthExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "AirSmall", new Animation(_content.Load <Texture2D>("Video/Effects/AirExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "PowerUp", new Animation(_content.Load <Texture2D>("Video/Effects/PowerUpExplosion"), 1) { FrameSpeed = 1f, } }, { "FireWhirl", new Animation(_content.Load <Texture2D>("Video/Effects/FireWhirl"), 1) { FrameSpeed = 1f, } }, { "GroundPoundExplosion", new Animation(_content.Load <Texture2D>("Video/Effects/GroundPoundExplosion"), 1) { FrameSpeed = 0.5f, } }, }; var explosionPrefab = new Explosion(explosion); var groundPoundPrefab = new GroundPound(groundPound) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var fireWhirlPrefab = new FireWhirl(fireWhirl) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var dartPrefab = new Dart(dart) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var torchPrefab = new Torch(torch) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var spiritPrefab = new Spirit(spirit) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var shadowWhirlPrefab = new ShadowWhirl(shadowWhirl) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; #endregion #region Collectibles var money = _content.Load <Texture2D>("Square"); var moneyPrefab = new Money(money) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var powerup = _content.Load <Texture2D>("Video/Hurtboxes/PowerUp"); var powerupPrefab = new PowerUp(powerup) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; #endregion #region Animations var playerAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Player/WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Player/WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Player/Attack"), 2) { FrameSpeed = 0.05f, } }, }; var tikiWarriorAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2Attack"), 2) { FrameSpeed = 0.05f, } }, }; var tikiDarterAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2Attack"), 2) { FrameSpeed = 0.05f, } }, }; var tikiTorcherAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2Attack"), 2) { FrameSpeed = 0.05f, } }, }; var tikiShamanAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyWalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyWalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyAttack"), 2) { FrameSpeed = 0.05f, } }, }; var enemyAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyWalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyWalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/EnemyAttack"), 2) { FrameSpeed = 0.05f, } }, }; var chestSmallAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Chests/ChestSmall"), 1) }, }; var chestMediumAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Chests/ChestMedium"), 1) }, }; var chestLargeAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Chests/ChestLarge"), 1) }, }; var chestPowerUpAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Chests/ChestPowerUp"), 1) }, }; var chestCheckPointAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Chests/ChestCheckPoint"), 1) }, }; var bossDoorAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/BossDoor"), 1) }, }; var trapAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/Trap"), 1) }, }; #endregion #region SpriteList _sprites = new List <Sprite>() { new Player(playerTexture) { Game = _game, Level = Levels.TestLevel, Position = new Vector2(4 * 92, 44 * 92), SoundManager = new SoundManager(backgroundMusic, playerSoundEffects), CollisionType = CollisionTypes.Full, GroundPound = groundPoundPrefab, FireWhirl = fireWhirlPrefab, Explosion = explosionPrefab, Layer = 0.1f, CameraTarget = true, Input = new Input() { Left = Keys.A, Right = Keys.D, Jump = Keys.Space, Attack = Keys.RightControl, Sprint = Keys.LeftShift, FastFall = Keys.S, StrongJump = Keys.W, }, Animations = new Dictionary <string, Animation>(playerAnimations), AnimationManager = new AnimationManager(playerAnimations.First().Value) { Texture = texture, }, }, }; #endregion #region Map _camera = new Camera(); Tile.Content = _content; _map = new Map() { Sound = new SoundManager(backgroundMusic, playerSoundEffects), }; String inputTiles = File.ReadAllText("Levels/TestLevel/TestLevelTilemap.txt"); _gridWidth = 500; _gridHeight = 50; _grid = new int[_gridHeight, _gridWidth]; int i = 0, j = 0; foreach (var row in inputTiles.Split('\n')) { j = 0; foreach (var col in row.Trim().Split(',')) { _grid[i, j] = int.Parse(col.Trim()); j++; } i++; } _map.Generate(_grid, _tileSize, _level); foreach (var tile in _map.CollisionTiles) { _sprites.Add(tile); } #endregion #region Enemies String inputEnemies = File.ReadAllText("Levels/TestLevel/TestLevelEnemymap.txt"); _gridWidth = 500; _gridHeight = 50; _grid = new int[_gridHeight, _gridWidth]; i = 0; j = 0; foreach (var row in inputEnemies.Split('\n')) { j = 0; foreach (var col in row.Trim().Split(',')) { _grid[i, j] = int.Parse(col.Trim()); switch (_grid[i, j]) { case 10: _sprites.Add(new TikiWarrior(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, ShadowWhirl = shadowWhirlPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(tikiWarriorAnimations), AnimationManager = new AnimationManager(tikiWarriorAnimations.First().Value) { Texture = texture, }, }); break; case 11: _sprites.Add(new TikiDarter(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Dart = dartPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(tikiDarterAnimations), AnimationManager = new AnimationManager(tikiDarterAnimations.First().Value) { Texture = texture, }, }); break; case 12: _sprites.Add(new TikiTorcher(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Torch = torchPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(tikiTorcherAnimations), AnimationManager = new AnimationManager(tikiTorcherAnimations.First().Value) { Texture = texture, }, }); break; case 13: _sprites.Add(new TikiShaman(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Spirit = spiritPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(tikiShamanAnimations), AnimationManager = new AnimationManager(tikiShamanAnimations.First().Value) { Texture = texture, }, }); break; case 14: _sprites.Add(new TrapDarter(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Dart = dartPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(trapAnimations), AnimationManager = new AnimationManager(trapAnimations.First().Value) { Texture = texture, }, }); break; case 15: _sprites.Add(new TrapTorcherRotateCW(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Torch = torchPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(trapAnimations), AnimationManager = new AnimationManager(trapAnimations.First().Value) { Texture = texture, }, }); break; case 16: _sprites.Add(new TrapTorcherRotateCCW(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Torch = torchPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(trapAnimations), AnimationManager = new AnimationManager(trapAnimations.First().Value) { Texture = texture, }, }); break; case 17: _sprites.Add(new TrapShaman(playerTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Spirit = spiritPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(trapAnimations), AnimationManager = new AnimationManager(trapAnimations.First().Value) { Texture = texture, }, }); break; case 18: _sprites.Add(new ChestSmall(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(chestSmallAnimations), AnimationManager = new AnimationManager(chestSmallAnimations.First().Value) { Texture = texture, }, }); break; case 19: _sprites.Add(new ChestMedium(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(chestMediumAnimations), AnimationManager = new AnimationManager(chestMediumAnimations.First().Value) { Texture = texture, }, }); break; case 20: _sprites.Add(new ChestLarge(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(chestLargeAnimations), AnimationManager = new AnimationManager(chestLargeAnimations.First().Value) { Texture = texture, }, }); break; case 21: _sprites.Add(new ChestPowerUp(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(chestPowerUpAnimations), AnimationManager = new AnimationManager(chestPowerUpAnimations.First().Value) { Texture = texture, }, }); break; case 22: _sprites.Add(new ChestCheckPoint(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(chestCheckPointAnimations), AnimationManager = new AnimationManager(chestCheckPointAnimations.First().Value) { Texture = texture, }, }); break; case 23: _sprites.Add(new BossDoor(chestTexture) { Position = new Vector2(j * 92, i * 92), SoundManager = new SoundManager(backgroundMusic, chestSoundEffects), CollisionType = CollisionTypes.Full, Money = moneyPrefab, PowerUp = powerupPrefab, Explosion = explosionPrefab, Layer = 0.3f, AI = new AI(), Animations = new Dictionary <string, Animation>(bossDoorAnimations), AnimationManager = new AnimationManager(bossDoorAnimations.First().Value) { Texture = texture, }, }); break; } j++; } i++; } #endregion #region UserInterface var playerPortraitTexture = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth3"); foreach (var player in _sprites.Select(c => c as Player)) { if (player is Player) { _player = player; } } _components = new List <Component>() { new PlayerInfo(playerPortraitTexture) { Position = new Vector2(50, 50), Text = "Quit", Player = _player, PlayerHealth2 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth2"), PlayerHealth1 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth1"), PlayerHealth0 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth0"), }, }; #endregion }
public BossRoom(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content) { _camera = new Camera(); // --- TEXTURES --- var texture = _content.Load <Texture2D>("Square"); var playerTexture = _content.Load <Texture2D>("Video/Player/Player"); var chestTexture = _content.Load <Texture2D>("Video/Enemies/Chests/ChestSize"); _staticBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/StaticBackgroundNight"); _farBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/FarBackground"); _midBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/MidBackground"); _directBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/DirectBackground"); _frontBackgroundTexture = _content.Load <Texture2D>("Video/Backgrounds/LevelFire/FrontBackground"); _frontBackgroundPosition = new Vector2(0, 0); _midBackgroundPosition = new Vector2(0, 0); _farBackgroundPosition = new Vector2(0, 0); // --- SOUND --- var backgroundMusic = _content.Load <Song>("Audio/Music/ThemeSong"); var levelSoundEffects = new List <SoundEffect>() { //_content.Load<SoundEffect>("BallHitsBat"), //_content.Load<SoundEffect>("BallHitsWall"), //_content.Load<SoundEffect>("PlayerScores"), }; var tileSoundEffects = new List <SoundEffect>() { //_content.Load<SoundEffect>("Sound/Tile/Break1"), //_content.Load<SoundEffect>("Sound/Tile/Break2"), }; var playerSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Player/FireWhirl"), // 0 _content.Load <SoundEffect>("Audio/Sound/Player/FastFall"), _content.Load <SoundEffect>("Audio/Sound/Player/Hurt1"), _content.Load <SoundEffect>("Audio/Sound/Player/Hurt2"), _content.Load <SoundEffect>("Audio/Sound/Player/Attack1"), _content.Load <SoundEffect>("Audio/Sound/Player/Attack2"), // 5 _content.Load <SoundEffect>("Audio/Sound/Player/Attack3"), _content.Load <SoundEffect>("Audio/Sound/Player/StopCast"), _content.Load <SoundEffect>("Audio/Sound/Player/GroundPound"), _content.Load <SoundEffect>("Audio/Sound/Player/Sprint"), _content.Load <SoundEffect>("Audio/Sound/Player/Jump1"), // 10 _content.Load <SoundEffect>("Audio/Sound/Player/Jump2"), _content.Load <SoundEffect>("Audio/Sound/Player/WallJump"), _content.Load <SoundEffect>("Audio/Sound/Player/Cast1"), _content.Load <SoundEffect>("Audio/Sound/Player/Cast2"), _content.Load <SoundEffect>("Audio/Sound/Player/Death"), // 15 _content.Load <SoundEffect>("Audio/Sound/Player/StopSprint"), _content.Load <SoundEffect>("Audio/Sound/Player/Walk"), _content.Load <SoundEffect>("Audio/Sound/Player/JumpPad"), _content.Load <SoundEffect>("Audio/Sound/Player/Respawn"), }; var tikiEnemySoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/FireWhirl"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/FastFall"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Hurt1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Hurt2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Attack3"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/StopCast"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/GroundPound"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Sprint"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Jump1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Jump2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/WallJump"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Cast1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Cast2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Death"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/StopSprint"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Walk"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Dart"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/Spirit"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchCast"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchLaunch"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/TorchFireLaunch"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/DartFire"), _content.Load <SoundEffect>("Audio/Sound/Enemies/TikiEnemy/SpiritFire"), }; var chestSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break1"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break2"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break3"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break4"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/Break5"), _content.Load <SoundEffect>("Audio/Sound/Enemies/Chest/BreakGreater"), }; var spellSoundEffects = new List <SoundEffect>() { _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire1"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire2"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Fire3"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/Spirit"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/SpiritHit"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney12"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney5"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney10"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectMoney25"), _content.Load <SoundEffect>("Audio/Sound/Hurtboxes/CollectPowerUp"), }; _soundManager = new SoundManager(backgroundMusic, levelSoundEffects); //_soundManager.PlayMusic(); // --- HURTBOXES --- var groundPound = _content.Load <Texture2D>("Video/Hurtboxes/GroundPound"); var fireWhirl = _content.Load <Texture2D>("Video/Effects/DefaultExplosion"); var shadowWhirl = _content.Load <Texture2D>("Video/Effects/DefaultExplosion"); var dart = _content.Load <Texture2D>("Square"); var torch = _content.Load <Texture2D>("Square"); var spirit = _content.Load <Texture2D>("Square"); var explosion = new Dictionary <string, Models.Animation>() { { "Explode", new Animation(_content.Load <Texture2D>("Video/Effects/DefaultExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Water", new Animation(_content.Load <Texture2D>("Video/Effects/WaterExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Fire", new Animation(_content.Load <Texture2D>("Video/Effects/FireExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Earth", new Animation(_content.Load <Texture2D>("Video/Effects/EarthExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Air", new Animation(_content.Load <Texture2D>("Video/Effects/AirExplosion"), 1) { FrameSpeed = 0.5f, } }, { "Shadow", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosion"), 1) { FrameSpeed = 0.5f, } }, { "ShadowWhirl", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowWhirl"), 1) { FrameSpeed = 0.5f, } }, { "ShadowSmall", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "ShadowTiny", new Animation(_content.Load <Texture2D>("Video/Effects/ShadowExplosionTiny"), 1) { FrameSpeed = 0.5f, } }, { "WaterSmall", new Animation(_content.Load <Texture2D>("Video/Effects/WaterExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "FireSmall", new Animation(_content.Load <Texture2D>("Video/Effects/FireExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "EarthSmall", new Animation(_content.Load <Texture2D>("Video/Effects/EarthExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "AirSmall", new Animation(_content.Load <Texture2D>("Video/Effects/AirExplosionSmall"), 1) { FrameSpeed = 0.5f, } }, { "PowerUp", new Animation(_content.Load <Texture2D>("Video/Effects/PowerUpExplosion"), 1) { FrameSpeed = 1f, } }, { "FireWhirl", new Animation(_content.Load <Texture2D>("Video/Effects/FireWhirl"), 1) { FrameSpeed = 1f, } }, { "GroundPoundExplosion", new Animation(_content.Load <Texture2D>("Video/Effects/GroundPoundExplosion"), 1) { FrameSpeed = 0.5f, } }, }; var explosionPrefab = new Explosion(explosion); var groundPoundPrefab = new GroundPound(groundPound) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var fireWhirlPrefab = new FireWhirl(fireWhirl) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var dartPrefab = new Dart(dart) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var torchPrefab = new Torch(torch) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var spiritPrefab = new Spirit(spirit) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var shadowWhirlPrefab = new ShadowWhirl(shadowWhirl) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; // --- COLLECTIBLES --- var money = _content.Load <Texture2D>("Square"); var moneyPrefab = new Money(money) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; var powerup = _content.Load <Texture2D>("Video/Hurtboxes/PowerUp"); var powerupPrefab = new PowerUp(powerup) { Explosion = explosionPrefab, SoundManager = new SoundManager(backgroundMusic, spellSoundEffects), }; // --- ANIMATIONS --- var playerAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Player/WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Player/WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Player/Attack"), 2) { FrameSpeed = 0.05f, } }, }; var tikiTorcherAnimations = new Dictionary <string, Animation>() { { "MoveLeft", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingLeft"), 3) }, { "MoveRight", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2WalkingRight"), 3) }, { "Attack", new Animation(_content.Load <Texture2D>("Video/Enemies/TikiEnemy/Enemy2Attack"), 2) { FrameSpeed = 0.05f, } }, }; // --- MAP --- Tile.Content = _content; _map = new Map() { Sound = new SoundManager(backgroundMusic, playerSoundEffects), }; String inputTiles = File.ReadAllText("Levels/BossRoom/BossRoomTilemap.txt"); _gridWidth = 30; _gridHeight = 20; _grid = new int[_gridHeight, _gridWidth]; int i = 0, j = 0; foreach (var row in inputTiles.Split('\n')) { j = 0; foreach (var col in row.Trim().Split(',')) { _grid[i, j] = int.Parse(col.Trim()); j++; } i++; } _map.Generate(_grid, _tileSize, _level); // --- PLAYER --- _sprites = new List <Sprite>() { new Player(playerTexture) { Game = _game, Level = Levels.BossRoom, Position = new Vector2(14 * 92, 2 * 92), SoundManager = new SoundManager(backgroundMusic, playerSoundEffects), CollisionType = CollisionTypes.Full, GroundPound = groundPoundPrefab, FireWhirl = fireWhirlPrefab, Explosion = explosionPrefab, Layer = 0.1f, CameraTarget = true, Input = new Input() { Left = Keys.A, Right = Keys.D, Jump = Keys.Space, Attack = Keys.RightControl, Sprint = Keys.LeftShift, FastFall = Keys.S, StrongJump = Keys.W, }, Animations = new Dictionary <string, Animation>(playerAnimations), AnimationManager = new AnimationManager(playerAnimations.First().Value) { Texture = texture, }, }, new TikiTorcher(playerTexture) { Position = new Vector2(12 * 92, 17 * 92), SoundManager = new SoundManager(backgroundMusic, tikiEnemySoundEffects), CollisionType = CollisionTypes.Full, Torch = torchPrefab, ShadowWhirl = shadowWhirlPrefab, Spirit = spiritPrefab, Money = moneyPrefab, Explosion = explosionPrefab, Layer = 0.1f, AI = new AI(), Animations = new Dictionary <string, Animation>(tikiTorcherAnimations), AnimationManager = new AnimationManager(tikiTorcherAnimations.First().Value) { Texture = texture, }, }, }; foreach (var tile in _map.CollisionTiles) { _sprites.Add(tile); } var playerPortraitTexture = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth3"); foreach (var player in _sprites.Select(c => c as Player)) { if (player is Player) { _player = player; } } _components = new List <Component>() { new PlayerInfo(playerPortraitTexture) { Position = new Vector2(50, 50), Text = "Quit", Player = _player, PlayerHealth2 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth2"), PlayerHealth1 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth1"), PlayerHealth0 = _content.Load <Texture2D>("Video/UserInterface/PlayerInfo/PlayerHealth0"), }, }; }