public override Room SetupLevel(Player player) { Vector2 bottomStart = Room.TileToWorldPos(new Vector2(bottom.width * 0.5f, bottom.height - 2.5f)); Vector2 bottomEnd = Room.TileToWorldPos(new Vector2(bottom.width * 0.5f, 3.5f)); Vector2 centerBottom = Room.TileToWorldPos(new Vector2(center.width * 0.5f, center.height - 2.5f)); Vector2 centerTopLeft = Room.TileToWorldPos(new Vector2(2.5f, 2.5f)); Vector2 topLeftStart = Room.TileToWorldPos(new Vector2(topLeft.width - 2.5f, topLeft.height - 2.5f)); Vector2 centerTopRight = Room.TileToWorldPos(new Vector2(center.width - 2.5f, 2.5f)); Vector2 topRightStart = Room.TileToWorldPos(new Vector2(topRight.width * 0.5f, topRight.height - 2.5f)); Vector2 centerBottomLeft = Room.TileToWorldPos(new Vector2(2.5f, center.height - 2.5f)); Vector2 bottomLeftStart = Room.TileToWorldPos(new Vector2(bottomLeft.width - 2.5f, bottomLeft.height - 2.5f)); Vector2 centerBottomRight = Room.TileToWorldPos(new Vector2(center.width - 2.5f, center.height - 2.5f)); Vector2 bottomRightStart = Room.TileToWorldPos(new Vector2(2.5f, bottomRight.height - 2.5f)); Vector2 centerTop = Room.TileToWorldPos(new Vector2(center.width * 0.5f, 2.5f)); Vector2 topStart = Room.TileToWorldPos(new Vector2(top.width * 0.5f, top.height - 2.5f)); Vector2 topEnd = Room.TileToWorldPos(new Vector2(top.width * 0.5f, 2.5f)); Vector2 restStart = Room.TileToWorldPos(new Vector2(rest.width * 0.5f, rest.height - 2.5f)); Vector2 bossStart = Room.TileToWorldPos(new Vector2(bossRoom.width * 0.5f, bossRoom.height - 2.5f)); player.position = new Vector2(60f, 60f); start.SetupFloorsAndWalls(); start.AddPuzzle(1, 1, new Portal(bottom, bottomStart)); bottom.SetupFloorsAndWalls(); bottom.AddPuzzle(bottomStart, new Checkpoint()); bottom.FillFloor(6, 10, 1, 18, 2); for (int k = 1; k < bottom.height - 1; k++) { if (k == 4) { continue; } bottom.AddPuzzle(1, k, new Lava()); bottom.AddPuzzle(2, k, new Lava()); bottom.AddPuzzle(bottom.width - 2, k, new Lava()); bottom.AddPuzzle(bottom.width - 3, k, new Lava()); } bottom.FillWall(1, 7, 4, 4); bottom.FillWall(9, 15, 4, 4); bottom.AddPuzzle(8, 4, new BrownDoor(true)); bottom.AddPuzzle(8, 2, new Portal(center, centerBottom)); center.SetupFloorsAndWalls(2); center.AddPuzzle(center.width / 2, center.height - 2, new Portal(bottom, bottomEnd)); for (int i = center.width / 4; i <= 3 * center.width / 4; i += center.width / 2) { for (int j = center.height / 4; j <= 3 * center.height / 4; j += center.height / 2) { for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { center.AddPuzzle(i + x, j + y, new Lava()); } } center.FillFloor(i - 3, i + 3, j - 3, j + 3); } } center.AddPuzzle(center.width / 2, center.height / 2, new Checkpoint()); center.AddPuzzle(1, 1, new Portal(topLeft, topLeftStart)); center.AddPuzzle(center.width - 2, 1, new Portal(topRight, topRightStart)); center.AddPuzzle(1, center.height - 2, new Portal(bottomLeft, bottomLeftStart)); center.AddPuzzle(center.width - 2, center.height - 2, new Portal(bottomRight, bottomRightStart)); center.FillWall(9, 9, 1, 8); center.FillWall(11, 11, 1, 8); for (int k = 2; k <= 8; k += 2) { center.AddPuzzle(center.width / 2, k, new SilverDoor(true)); } center.AddPuzzle(center.width / 2, 1, new Portal(top, topStart)); #region topLeft topLeft.SetupFloorsAndWalls(2); for (int x = 1; x <= 20; x++) { for (int y = 1; y <= 20; y++) { topLeft.AddPuzzle(x, y, new Lava()); } } for (int x = 18; x <= 20; x++) { for (int y = 18; y <= 20; y++) { topLeft.RemovePuzzle(x, y); } } topLeft.AddPuzzle(20, 20, new Portal(center, centerTopLeft)); topLeft.AddPuzzle(19, 19, new Checkpoint()); for (int x = 14; x <= 17; x++) { topLeft.RemovePuzzle(x, 19); } topLeft.RemovePuzzle(14, 18); for (int x = 5; x <= 14; x++) { topLeft.RemovePuzzle(x, 17); } for (int x = 7; x <= 11; x++) { topLeft.RemovePuzzle(x, 20); } for (int x = 7; x <= 11; x += 2) { FixedTurret turret = new FixedTurret(Room.TileToWorldPos(new Vector2(x + 0.5f, 20.5f)), new Vector2(0f, -4f)); turret.bulletTime = 240; topLeft.enemies.Add(turret); } topLeft.AddPuzzle(5, 17, new Switch(TopLeftSwitch1)); topLeft.AddPuzzle(12, 16, new BlueDoor(true)); for (int x = 3; x <= 12; x++) { topLeft.RemovePuzzle(x, 15); } for (int y = 15; y <= 17; y++) { topLeft.RemovePuzzle(2, y); } for (int y = 17; y <= 19; y++) { topLeft.RemovePuzzle(3, y); } topLeft.AddPuzzle(2, 19, new Switch(TopLeftSwitch2)); topLeft.AddPuzzle(5, 14, new BlueDoor(true)); for (int x = 3; x <= 5; x++) { topLeft.RemovePuzzle(x, 13); topLeft.RemovePuzzle(x, 11); topLeft.RemovePuzzle(x, 9); topLeft.RemovePuzzle(x, 7); } topLeft.RemovePuzzle(3, 12); topLeft.RemovePuzzle(5, 10); topLeft.RemovePuzzle(3, 8); for (int y = 7; y <= 13; y++) { topLeft.RemovePuzzle(1, y); } for (int y = 8; y <= 12; y += 2) { FixedTurret turret = new FixedTurret(Room.TileToWorldPos(new Vector2(1.5f, y + 0.5f)), new Vector2(4f, 0f)); turret.bulletTime = 240; topLeft.enemies.Add(turret); } topLeft.RemovePuzzle(5, 6); topLeft.RemovePuzzle(5, 5); topLeft.RemovePuzzle(6, 5); for (int y = 3; y <= 5; y++) { topLeft.RemovePuzzle(7, y); topLeft.RemovePuzzle(9, y); topLeft.RemovePuzzle(11, y); } topLeft.RemovePuzzle(6, 5); topLeft.RemovePuzzle(8, 3); topLeft.RemovePuzzle(10, 5); for (int x = 11; x <= 19; x++) { topLeft.RemovePuzzle(x, 3); } for (int y = 4; y <= 8; y++) { topLeft.RemovePuzzle(15, y); } topLeft.AddPuzzle(16, 8, new Switch(TopLeftSwitch3)); for (int y = 4; y <= 17; y++) { topLeft.RemovePuzzle(19, y); } topLeft.AddPuzzle(19, 6, new BlueDoor(true)); for (int y = 6; y <= 17; y++) { topLeft.RemovePuzzle(18, y); topLeft.RemovePuzzle(20, y); } topLeft.FillWall(18, 18, 6, 12); topLeft.FillWall(20, 20, 6, 12); for (int y = 12; y <= 18; y++) { topLeft.RemovePuzzle(17, y); } topLeft.FillWall(17, 17, 12, 18); topLeft.SetWall(18, 16, 1); topLeft.SetWall(18, 17, 1); topLeft.SetWall(20, 16, 1); topLeft.SetWall(20, 17, 1); topLeft.RemovePuzzle(17, 20); topLeft.SetWall(17, 20, 1); topLeft.AddPuzzle(19, 14, new SilverKey()); topLeft.AddPuzzle(19, 16, new Switch(TopLeftSwitch4)); topLeft.AddPuzzle(19, 17, new BlueDoor(true)); topLeft.AddPuzzle(14, 7, new BlueDoor(false)); topLeft.RemovePuzzle(13, 7); topLeft.AddPuzzle(12, 7, new Checkpoint()); topLeft.RemovePuzzle(12, 8); for (int x = 7; x <= 11; x++) { for (int y = 8; y <= 12; y++) { if (x % 2 == 1 || y % 2 == 0) { topLeft.RemovePuzzle(x, y); } } } topLeft.RemovePuzzle(10, 9); topLeft.AddPuzzle(7, 12, new LifeCapsule()); topLeft.OnExit += TopLeftExit; #endregion #region topRight topRight.SetupFloorsAndWalls(); topRight.AddPuzzle(topRight.width / 2, topRight.height - 2, new Portal(center, centerTopRight)); topRight.AddPuzzle(topRight.width / 2, topRight.height - 3, new Checkpoint()); for (int x = 1; x <= 3; x++) { for (int y = 53; y <= 55; y++) { topRight.AddPuzzle(x, y, new Lava()); } } for (int x = 13; x <= 15; x++) { for (int y = 53; y <= 55; y++) { topRight.AddPuzzle(x, y, new Lava()); } } topRight.FillWall(1, 7, 52, 52); topRight.AddPuzzle(8, 52, new BlueDoor(true, true)); topRight.FillWall(9, 15, 52, 52); MakeMonsterRoom1(); Puzzle puzzle = new InvisibleSwitch(monsterRoom1.DoAction); topRight.AddPuzzle(7, 51, puzzle); topRight.AddPuzzle(8, 50, puzzle); topRight.AddPuzzle(9, 51, puzzle); topRight.FillFloor(4, 12, 40, 48, 2); topRight.FillWall(1, 7, 36, 36); topRight.AddPuzzle(8, 36, new BlueDoor(true, true)); topRight.FillWall(9, 15, 36, 36); MakeMonsterRoom2(); puzzle = new InvisibleSwitch(monsterRoom2.DoAction); topRight.AddPuzzle(7, 35, puzzle); topRight.AddPuzzle(8, 34, puzzle); topRight.AddPuzzle(9, 35, puzzle); topRight.FillFloor(4, 12, 24, 32, 2); topRight.FillWall(1, 7, 20, 20); topRight.AddPuzzle(8, 20, new BlueDoor(true, true)); topRight.FillWall(9, 15, 20, 20); MakeMonsterRoom3(); puzzle = new InvisibleSwitch(monsterRoom3.DoAction); topRight.AddPuzzle(7, 19, puzzle); topRight.AddPuzzle(8, 18, puzzle); topRight.AddPuzzle(9, 19, puzzle); topRight.FillFloor(4, 12, 8, 16, 2); topRight.FillWall(1, 7, 4, 4); topRight.AddPuzzle(8, 4, new BlueDoor(true, true)); topRight.FillWall(9, 15, 4, 4); for (int x = 1; x <= 3; x++) { for (int y = 1; y <= 3; y++) { topRight.AddPuzzle(x, y, new Lava()); } } topRight.AddPuzzle(8, 2, new SilverKey()); for (int x = 13; x <= 15; x++) { for (int y = 1; y <= 3; y++) { topRight.AddPuzzle(x, y, new Lava()); } } topRight.OnExit += TopRightExit; #endregion topRight #region bottomLeft bottomLeft.SetupFloorsAndWalls(2); bottomLeft.FillFloor(1, 15, 1, 9); bottomLeft.AddPuzzle(bottomLeft.width - 2, bottomLeft.height - 2, new Portal(center, centerBottomLeft)); bottomLeft.AddPuzzle(bottomLeft.width - 3, bottomLeft.height - 3, new Checkpoint()); bottomLeft.FillWall(1, 3, 1, 2); bottomLeft.FillWall(6, 7, 1, 2); bottomLeft.FillWall(10, 11, 1, 2); bottomLeft.FillWall(14, bottomLeft.width - 1, 1, 2); Boulder.Add(bottomLeft, 4, 3); Boulder.Add(bottomLeft, 8, 3); Boulder.Add(bottomLeft, 12, 3); bottomLeft.FillWall(1, 3, 5, 5); bottomLeft.FillWall(6, 7, 5, 5); bottomLeft.FillWall(10, 11, 5, 5); bottomLeft.FillWall(14, 15, 5, 5); for (int x = 1; x <= 15; x++) { for (int y = 6; y <= 7; y++) { bottomLeft.AddPuzzle(x, y, new Lava()); } } bottomLeft.FillWall(1, 8, 10, 10); bottomLeft.AddPuzzle(9, 10, new Lever(Direction.Left, BottomLeftLever)); bottomLeft.FillWall(10, 15, 10, 10); bottomLeft.FillWall(16, 16, 5, 10); bottomLeft.AddPuzzle(1, 4, new SilverKey()); bottomLeft.enemies.Add(new Cannon(Room.TileToWorldPos(new Vector2(2f, 9f)), new Vector2(4f, 0f))); bottomLeft.AddEnemyWithDefaultPos(new FireWizard(Room.TileToWorldPos( new Vector2(3.5f, bottomLeft.height - 3f)))); #endregion #region bottomRight bottomRight.SetupFloorsAndWalls(); bottomRight.FillFloor(3, bottomRight.width - 4, 3, bottomRight.height - 4, 2); bottomRight.AddPuzzle(1, bottomRight.height - 2, new Portal(center, centerBottomRight)); bottomRight.AddPuzzle(2, bottomRight.height - 3, new Checkpoint()); bottomRight.FillWall(bottomRight.width - 4, bottomRight.width - 2, bottomRight.height - 3, bottomRight.height - 3); bottomRight.AddPuzzle(bottomRight.width - 4, bottomRight.height - 2, new BlueDoor(false)); bottomRight.AddPuzzle(bottomRight.width - 2, bottomRight.height - 2, new SilverKey()); for (int x = 5; x <= 15; x += 5) { for (int y = 5; y <= 15; y += 5) { bottomRight.AddPuzzle(x, y, new Lever(BottomRightLever(x, y))); bottomRight.AddPuzzle(x, y - 1, new LightBulb()); } } bottomRight.AddEnemyWithDefaultPos(new FireWizard(Room.TileToWorldPos( new Vector2(8.5f, bottomRight.height - 8.5f)))); #endregion #region top top.SetupFloorsAndWalls(); top.AddPuzzle(top.width / 2, top.height - 2, new Portal(center, centerTop)); top.AddPuzzle(top.width / 2, top.height - 3, new Checkpoint()); for (int x = 1; x <= 3; x++) { for (int y = top.height - 4; y <= top.height - 2; y++) { top.AddPuzzle(x, y, new Lava()); } } for (int x = 13; x <= 15; x++) { for (int y = top.height - 4; y <= top.height - 2; y++) { top.AddPuzzle(x, y, new Lava()); } } top.FillWall(1, 7, top.height - 5, top.height - 5); top.AddPuzzle(8, top.height - 5, new BlueDoor(true, true)); top.FillWall(9, 15, top.height - 5, top.height - 5); MakeTopMonsterRoom(); puzzle = new InvisibleSwitch(topMonsterRoom.DoAction); top.AddPuzzle(7, top.height - 6, puzzle); top.AddPuzzle(8, top.height - 7, puzzle); top.AddPuzzle(9, top.height - 6, puzzle); top.FillFloor(4, 12, 8, top.height - 9, 2); top.FillWall(1, 7, 4, 4); top.AddPuzzle(8, 4, new BlueDoor(true, true)); top.FillWall(9, 15, 4, 4); for (int x = 1; x <= 3; x++) { for (int y = 1; y <= 3; y++) { top.AddPuzzle(x, y, new Lava()); } } top.AddPuzzle(8, 1, new Portal(rest, restStart)); for (int x = 13; x <= 15; x++) { for (int y = 1; y <= 3; y++) { top.AddPuzzle(x, y, new Lava()); } } top.OnExit += TopExit; #endregion top rest.SetupFloorsAndWalls(); rest.FillFloor(5, 7, 1, rest.height - 2, 2); rest.AddPuzzle(rest.width / 2, rest.height - 2, new Portal(top, topEnd)); rest.AddPuzzle(rest.width / 2, rest.height - 3, new Checkpoint()); for (int k = 3; k <= 9; k += 2) { rest.SetWall(3, k, 1); rest.SetWall(rest.width - 4, k, 1); } rest.AddPuzzle(rest.width / 2, rest.height / 2, new LifeCapsule()); rest.AddPuzzle(rest.width / 2, 2, new Portal(bossRoom, bossStart)); bossRoom.SetupFloorsAndWalls(); bossRoom.OnEnter += BossRoomEnter; boss = new FireBoss(Room.TileToWorldPos(0.5f * new Vector2(bossRoom.width, bossRoom.height))); boss.OnDeath += Win; bossRoom.enemies.Add(boss); return start; }
public override Room SetupLevel(Player player) { Vector2 room1Start = Room.TileToWorldPos(new Vector2(room1.width * 0.5f, room1.height - 2.5f)); Vector2 room2Start = Room.TileToWorldPos(new Vector2(2.5f, room2.height * 0.5f)); Vector2 room3Start = Room.TileToWorldPos(new Vector2(6.5f, room3.height * 0.5f)); Vector2 room4Start = Room.TileToWorldPos(new Vector2(room4.width * 0.5f, room4.height - 2.5f)); Vector2 room5Start = Room.TileToWorldPos(new Vector2(room5.width * 0.5f, room5.height - 2.5f)); Vector2 room6Start = Room.TileToWorldPos(new Vector2(room6.width * 0.5f, room6.height - 2.5f)); Vector2 room7Start = Room.TileToWorldPos(new Vector2(room7.width * 0.5f, room7.height - 2.5f)); player.position = new Vector2(60f, 60f); start.SetupFloorsAndWalls(); start.AddPuzzle(1, 1, new Portal(room1, room1Start)); room1.SetupFloorsAndWalls(); room1.SetWall(room1.width / 2, room1.height - 7, 2); room1.SetWall(room1.width / 2 - 1, room1.height - 6, 3); room1.SetWall(room1.width / 2, room1.height - 6, 4); room1.SetWall(room1.width / 2 + 1, room1.height - 6, 5); room1.FillWall(1, room1.width / 2 - 2, 4, 4); room1.FillWall(room1.width / 2 + 2, room1.width - 2, 4, 4); room1.SetWall(room1.width / 2 - 1, 4, 6); room1.SetWall(room1.width / 2 + 1, 4, 6); room1.AddPuzzle(room1Start, new Checkpoint()); room1.AddPuzzle(room1.width / 2, 4, new BrownDoor(true)); room1.AddPuzzle(room1.width / 2, 2, new Portal(room2, room2Start)); room2.SetupFloorsAndWalls(2); room2.AddPuzzle(room2Start, new Checkpoint()); room2.FillWall(9, room2.width - 10, room2.height - 2, room2.height - 2, 6); room2.AddEnemyWithDefaultPos(new Spider(Tile.tileSize * new Vector2(20.5f, room2.height * 0.5f))); room2.AddPuzzle(room2.width - 3, room2.height / 2, new Portal(room3, room3Start)); room3.SetupFloorsAndWalls(); room3.FillWall(4, 4, 1, room3.height / 2 - 1); room3.FillWall(4, 4, room3.height / 2 + 1, room3.height - 2); room3.FillWall(12, 12, 1, room3.height / 2 - 1); room3.FillWall(12, 12, room3.height / 2 + 1, room3.height - 2); room3.SetWall(room3.width - 2, room3.height / 2, 3); room3.enemies.Add(new Turret(Tile.tileSize * new Vector2(room3.width - 4.5f, room3.height / 2f))); room3.AddPuzzle(12, room3.height / 2, new Checkpoint()); room3.AddPuzzle(2, room3.height / 2, new Portal(room4, room4Start)); room3.AddPuzzle(4, room3.height / 2, new BlueDoor(false)); room3.AddPuzzle(room3.width - 3, room3.height / 2, new Switch(Room3Switch)); room4.SetupFloorsAndWalls(); room4.FillFloor(1, 19, 1, 19, 2); room4.FillWall(1, 9, 20, 20); room4.FillWall(11, 23, 20, 20); room4.FillWall(20, 20, 1, 2); room4.FillWall(20, 20, 4, 19); room4.FillWall(21, 28, 6, 6); room4.FillWall(25, 27, 20, 20); room4.SetWall(10, 10, 6); room4.AddPuzzle(10, 24, new Checkpoint()); room4.AddPuzzle(10, 20, new BlueDoor(true, true)); room4.AddPuzzle(20, 3, new BlueDoor(false)); room4.AddPuzzle(24, 3, new SilverKey()); room4.AddPuzzle(24, 20, new SilverDoor(true)); CreateRoom4MonsterRoom(); Puzzle puzzle = new InvisibleSwitch(room4MonsterRoom.DoAction); room4.AddPuzzle(9, 19, puzzle); room4.AddPuzzle(10, 18, puzzle); room4.AddPuzzle(11, 19, puzzle); room4.AddPuzzle(24, 12, new Portal(room5, room5Start)); room4.OnExit += Room4Exit; room5.SetupFloorsAndWalls(); room5.FillFloor(1, 3, 1, 10, 2); room5.AddPuzzle(room5Start, new Checkpoint()); room5.FillWall(4, 4, 1, 10); room5.FillWall(2, 3, 1, 2); for (int k = 4; k <= 10; k += 2) { room5.SetWall(2, k, 1); room5.SetWall(3, k, 1); room5.AddPuzzle(5, k - 1, new BlueDoor(true)); } room5.AddPuzzle(3, 9, new Lever(Direction.Up, Room5Lever1)); room5.AddPuzzle(3, 7, new Lever(Direction.Up, Room5Lever2)); room5.AddPuzzle(3, 5, new Lever(Direction.Up, Room5Lever3)); room5.AddPuzzle(3, 3, new Lever(Direction.Up, Room5Lever4)); FixedTurret fixedTurret = new FixedTurret(Tile.tileSize * new Vector2(1.5f, 1.5f), new Vector2(0f, 4f)); fixedTurret.maxShootTimer = 120; room5.enemies.Add(fixedTurret); room5.AddPuzzle(5, 1, new Portal(room6, room6Start)); room6.SetupFloorsAndWalls(2); room6.AddPuzzle(room6Start, new Checkpoint()); for (int k = 3; k <= 9; k += 2) { room6.SetWall(3, k, 1); room6.SetWall(room6.width - 4, k, 1); } room6.AddPuzzle(room6.width / 2, room6.height / 2, new LifeCapsule()); room6.AddPuzzle(room6.width / 2, 2, new Portal(room7, room7Start)); room7.OnEnter += Room7Enter; room7.SetupFloorsAndWalls(); boss = new TutorialBoss(Tile.tileSize * new Vector2(room7.width * 0.5f, 2.5f), Tile.tileSize * 0.5f * new Vector2(room7.width, room7.height)); boss.OnDeath += Win; room7.enemies.Add(boss); return start; }