//rectifies collisions between the camera and the edge of the tile map, it will reset the tile map so that it doesn't
 //draw outside the tile map, keeping everything contained in the camera
 public void fixCameraCollisionWithTileMapBounds(LevelMap tm)
 {
     if (getWorldBoundingBox.Left < tm.getBoundingBox.Left)
     {
         currentWorldPosition.X = tm.getBoundingBox.Left;
     }
     if (getWorldBoundingBox.Top < tm.getBoundingBox.Top)
     {
         currentWorldPosition.Y = tm.getBoundingBox.Top;
     }
     if (getWorldBoundingBox.Right > tm.getBoundingBox.Right)
     {
         currentWorldPosition.X = tm.getBoundingBox.Right - cameraWidth;
     }
     if (getWorldBoundingBox.Bottom > tm.getBoundingBox.Bottom)
     {
         currentWorldPosition.Y = tm.getBoundingBox.Bottom - cameraHeight;
     }
 }
        public RegalFallsOne(ContentManager cm, GraphicsDeviceManager gdm, SpriteBatch sb, ImageLibrary iLibrary, Player pOne)
            : base(cm, gdm, sb)
        {
            nextLevel = NextLevelPointer.WorldOneLevelTwo;

            cmReference  = cm;
            gdmReference = gdm;
            sbReference  = sb;

            imageLibrary = iLibrary;

            parallaxBackgrounds = new List <ParallaxBackground>();

            platforms         = new List <Platform>();
            platformsToRemove = new List <Platform>();

            slopedPlatforms = new List <SlopedPlatform>();

            grindRails = new List <GrindRail>();
            tightRopes = new List <TightRope>();

            springs   = new List <Spring>();
            ladders   = new List <Ladder>();
            hurdles   = new List <Hurdle>();
            bearTraps = new List <BearTrap>();

            worldTreasure         = new List <Treasure>();
            worldTreasureToRemove = new List <Treasure>();

            endOfLevelTrigger = new EventTrigger();

            //System.Diagnostics.Debug.WriteLine(testPlatform.platformSlope.getSlope());

            //configures default map
            map = new LevelMap(cm, gdm, sb, new Vector2(344, 264), new Vector2(16, 16));
            //----------------------------------------------------------Start Map Configuration----------------------------------------
            int tileTrackerX = 0;
            int tileTrackerY = 0;

            //iterates through row by column and initializes based on some arbitrary distinctions
            while (tileTrackerY < map.tileMapHeight)
            {
                while (tileTrackerX < map.tileMapWidth)
                {
                    map.tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(map.tilePositionX, map.tilePositionY), new Vector2(16, 16), new Vector2(1, 1), imageLibrary.basicBlueTile, false, false, false, false);
                    map.tilePositionX += map.defaultTileWidth;
                    tileTrackerX++;
                }
                map.tilePositionX  = 0;
                tileTrackerX       = 0;
                map.tilePositionY += map.defaultTileHeight;
                tileTrackerY++;
            }
            //----------------------------------------------------------End Map Configuration----------------------------------------
            playerOneCamera = new Camera(cmReference, gdmReference, sbReference, new Vector2(0, 0), gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Width, gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera.screenPosition = new Vector2(graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, 0);

            playerOne = pOne;
            playerOne.previousWorldPosition = new Vector2(0, 0);
            playerOne.currentWorldPosition  = new Vector2(0, 0);

            //playerTwo = new playerOne(cm, sb, gdm);
            //playerTwo.currentWorldPosition = playerTwoCamera.worldPosition;

            //Configures the lists
            configureParallaxBackgrounds();
            configureWorldPlatforms();
            configureWorldSlopePlatforms();
            configureWorldGrindRails();
            configureWorldTightRopes();
            configureWorldSprings();
            configureWorldLadders();
            configureWorldHurdles();
            configureWorldBearTraps();
            configureWorldTreasure();

            gravity = new Vector2(0, 9);

            scoreFont = cmReference.Load <SpriteFont>("Fonts/PlaceholderFont");

            deathWatchTimer           = 0;
            deathWatchTimerTimerLimit = 60;
        }
        public TylerLevel(ContentManager cm, GraphicsDeviceManager gdm, SpriteBatch sb, ImageLibrary iLibrary, Player pOne) : base(cm, gdm, sb)
        {
            cmReference  = cm;
            gdmReference = gdm;
            sbReference  = sb;

            imageLibrary = iLibrary;

            parallaxBackgrounds = new List <ParallaxBackground>();

            platforms         = new List <Platform>();
            platformsToRemove = new List <Platform>();

            slopedPlatforms = new List <SlopedPlatform>();

            grindRails = new List <GrindRail>();

            springs = new List <Spring>();

            worldTreasure         = new List <Treasure>();
            worldTreasureToRemove = new List <Treasure>();

            //System.Diagnostics.Debug.WriteLine(testPlatform.platformSlope.getSlope());

            //configures default map
            map = new LevelMap(cm, gdm, sb, new Vector2(168, 260), new Vector2(16, 16));
            //----------------------------------------------------------Start Map Configuration----------------------------------------
            int tileTrackerX = 0;
            int tileTrackerY = 0;

            //iterates through row by column and initializes based on some arbitrary distinctions
            while (tileTrackerY < map.tileMapHeight)
            {
                while (tileTrackerX < map.tileMapWidth)
                {
                    map.tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(map.tilePositionX, map.tilePositionY), new Vector2(16, 16), new Vector2(1, 1), imageLibrary.basicBlueTile, false, false, false, false);
                    map.tilePositionX += map.defaultTileWidth;
                    tileTrackerX++;
                }
                map.tilePositionX  = 0;
                tileTrackerX       = 0;
                map.tilePositionY += map.defaultTileHeight;
                tileTrackerY++;
            }
            //----------------------------------------------------------End Map Configuration----------------------------------------
            playerOneCamera = new Camera(cmReference, gdmReference, sbReference, new Vector2(0, 0), gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Width, gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera.screenPosition = new Vector2(graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, 0);

            playerOne = pOne;
            playerOne.previousWorldPosition = new Vector2(0, 0);
            playerOne.currentWorldPosition  = new Vector2(0, 0);

            //playerTwo = new playerOne(cm, sb, gdm);
            //playerTwo.currentWorldPosition = playerTwoCamera.worldPosition;

            //Configures the lists
            configureParallaxBackgrounds();
            configureWorldPlatforms();
            configureWorldSlopePlatforms();
            configureWorldGrindRails();
            configureWorldSprings();
            configureWorldTreasure();

            gravity = new Vector2(0, 9);
        }