Example #1
0
        public Level7(GSPlay gsPlay)
            : base(gsPlay)
        {
            levelDataTexture = gsPlay.LoadTexture("Levels/level7Data");

            player1Pos = GridToPosition(5, 280);
            player2Pos = GridToPosition(7, 280);

            //player1Pos = GridToPosition(430, 123);
            //player2Pos = player1Pos;

            portalPos = GridToPosition(394, 41);
            pItemPos = GridToPosition(441, 119);

            renderCollision = false;

            SetupLevel();

            for (int x = 1; x <= 15; x++)
            {
                for (int y = 1; y <= 10; y++)
                {

                    string bgName = "LevelTiles/Construction/constructionCoolBG" + y + "x" + x;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.Two);
                    }

                }
            }
            for (int x = 1; x <= 15; x++)
            {
                for (int y = 1; y <= 10; y++)
                {

                    string bgName = "LevelTiles/Construction/constructionWarmBG" + y + "x" + x;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.One);
                    }

                }
            }

            leftLimit = 32;
            rightLimit = levelWidth;

            Vector2 bgPosition = new Vector2(-400, -300);
            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/constructionBackdropBase1"), bgPosition);
                    bg1.SetPlayerMode(PlayerObjectMode.One);
                    gsPlay.AddParallax(bg1, .1f);
                    SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/constructionBackdropBase2"), bgPosition);
                    bg2.SetPlayerMode(PlayerObjectMode.Two);
                    gsPlay.AddParallax(bg2, .1f);

                    bgPosition.Y += 1024;
                }

                bgPosition.X += 1024;
                bgPosition.Y = -300;
            }

            bgPosition = new Vector2(-300, -300);
            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/constructionBackdropOverlay1"), bgPosition);
                    bg1.SetPlayerMode(PlayerObjectMode.One);
                    gsPlay.AddParallax(bg1, .2f);
                    SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/constructionBackdropOverlay2"), bgPosition);
                    bg2.SetPlayerMode(PlayerObjectMode.Two);
                    gsPlay.AddParallax(bg2, .2f);

                    bgPosition.Y += 1024;
                }

                bgPosition.Y = -300;
                bgPosition.X += 1024;
            }

            bgPosition = new Vector2(-512, -512);
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    gsPlay.CreateGearMatte(bgPosition);

                    bgPosition.Y += 1024;
                }

                bgPosition.X += 1024;
                bgPosition.Y = -512;
            }

            TriggerArea update = gsPlay.AddTriggerArea(new EventTrigger(this, 99), Art.smoke, Vector2.Zero);
            update.visible = false;

            Sprite cameraTarget = new Sprite(GridToPosition(239, 278));
            gsPlay.cameraPlayer1.AddTarget(cameraTarget);
            gsPlay.cameraPlayer2.AddTarget(cameraTarget);

            SpriteIMG s = new SpriteIMG(gsPlay.LoadTexture("bgSky"), new Vector2(levelWidth / 2, levelHeight / 2));
            gsPlay.AddParallax(s, .5f);

            atmosphereLight = new Color(100, 100, 100);

            Moveable m1 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(95, 280)), .8f);                      //box under backhoe

            Moveable m2 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(161, 290)), .8f);                     //box in pit under platform

            MovingPlatform underCrane = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(153, 275)), Level.GridToPosition(new Point(153, 282)));
            FlipSwitch crane = gsPlay.AddSwitch(new EventTrigger(this, underCrane), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(126, 265)));                                                  //crane switch and platform
            LightningChain lc1 = gsPlay.AddLightning(crane.position, GridToPosition(130, 265), Color.Red);
            lc1.AddVertex(GridToPosition(137, 274));
            lc1.AddVertex(GridToPosition(141, 274));
            lc1.AddVertex(underCrane.position);
            lc1.ConvertEndPointToTarget(underCrane);
            crane.AddEvent(new EventTrigger(this, lc1));

            gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(195, 278)), .8f);                     //box before saw machine

            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(235, 277)), Level.GridToPosition(new Point(243, 277)));       //platform over saw machine

            gsPlay.AddBouncyBall(0, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(307, 286)));                     //ball under building

            Door leftBasement = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(313, 283)), Level.GridToPosition(new Point(309, 283)), OpenState.Closed);
            FlipSwitch s1 = gsPlay.AddSwitch(new EventTrigger(this, leftBasement), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(314, 281)));     //first horiz door
            s1.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lc2 = gsPlay.AddLightning(s1.position, leftBasement.position, Color.Red);
            lc2.ConvertEndPointToTarget(leftBasement);
            s1.AddEvent(new EventTrigger(this, lc2));

            Door rightBasement = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(319, 283)), Level.GridToPosition(new Point(323, 283)), OpenState.Closed);
            FlipSwitch s2 = gsPlay.AddSwitch(new EventTrigger(this, rightBasement), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(322, 288)));     //2nd horiz door
            s2.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc3 = gsPlay.AddLightning(s2.position, rightBasement.position, Color.Red);
            lc3.ConvertEndPointToTarget(rightBasement);
            s2.AddEvent(new EventTrigger(this, lc3));

            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(290, 282)), Level.GridToPosition(new Point(290, 209)));       //elevator

            Door d1 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(332, 213)), OpenState.Closed);                        //door to let ball in
            FlipSwitch ballDoor =  gsPlay.AddSwitch(new EventTrigger(this, d1), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(328, 208)));
            LightningChain lc4 = gsPlay.AddLightning(ballDoor.position, GridToPosition(328, 209) + new Vector2(0, 16), Color.Red);
            lc4.AddVertex(GridToPosition(332, 211) + new Vector2(0, -16));
            lc4.AddVertex(GridToPosition(332, 211) + new Vector2(0, 0));
            //lc6.ConvertEndPointToTarget(d5);
            ballDoor.AddEvent(new EventTrigger(this, lc4));

            Door d2 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(332, 207)), OpenState.Closed);                        //door opened by ball
            Button ballOn = gsPlay.AddButton(new EventTrigger(this, d2), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(335, 216)));
            LightningChain lc5 = gsPlay.AddLightning(ballOn.position,  GridToPosition(338, 216), Color.Red);
            lc5.AddVertex(GridToPosition(338, 210));
            lc5.AddVertex(GridToPosition(332, 210));
            lc5.AddVertex(GridToPosition(332, 209) + new Vector2(0, 0));
            ballOn.AddEvent(new EventTrigger(this, lc5));
            //338, 216
            //338, 210
            //332, 210
            //332, 209

            d3 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(370, 207)), OpenState.Closed);                               //fading doors over pit
            d5 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(376, 207)), OpenState.Open);
            FlipSwitch FS1 = gsPlay.AddMultiSwitch(new EventTrigger(this, 1), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(373, 202)));
            LightningChain lc6 = gsPlay.AddLightning(FS1.position, GridToPosition(370, 204) + new Vector2(0, 16), Color.Red);
            lc6.AddVertex(GridToPosition(370, 204) + new Vector2(0, 32));
            FS1.AddEvent(new EventTrigger(this, lc6));
            LightningChain lc7 = gsPlay.AddLightning(FS1.position, GridToPosition(376, 204) + new Vector2(0, 16), Color.Red);
            lc7.AddVertex(GridToPosition(376, 204) + new Vector2(0, 32));
            FS1.AddEvent(new EventTrigger(this, lc7));
            lc6.defaultActive = true;
            lc6.SetActive(true);

            MovingPlatform pitPlatform1 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(365, 210)), Level.GridToPosition(new Point(381, 210)));
            FlipSwitch pitPlatform1Switch = gsPlay.AddSwitch(new EventTrigger(this, pitPlatform1), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(364, 202)));     //platform with fading doors 1
            LightningChain lc8 = gsPlay.AddLightning(pitPlatform1Switch.position, GridToPosition(364, 210), Color.Red);
            lc8.AddVertex(pitPlatform1.position);
            lc8.ConvertEndPointToTarget(pitPlatform1);
            pitPlatform1Switch.AddEvent(new EventTrigger(this, lc8));

            Door d4 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(384, 201)), OpenState.Closed);                        //ease of access
            FlipSwitch easeOfAccess =  gsPlay.AddOnSwitch(new EventTrigger(this, d4), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(384, 208)));
            LightningChain lc9 = gsPlay.AddLightning(easeOfAccess.position, GridToPosition(384, 203) + new Vector2(0, 16), Color.Red);
            lc9.AddVertex(GridToPosition(384, 203) + new Vector2(0, 0));
            lc9.defaultActive = true;
            lc9.SetActive(true);
            easeOfAccess.AddEvent(new EventTrigger(this, lc9));

            MovingPlatform toCrane2p = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(384, 216)), Level.GridToPosition(new Point(360, 216)));
            FlipSwitch toCrane2s = gsPlay.AddSwitch(new EventTrigger(this, toCrane2p), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(393, 212)));     //platform to crane 2 switch
            LightningChain lc10 = gsPlay.AddLightning(toCrane2s.position, GridToPosition(393, 216), Color.Red);
            lc10.AddVertex(GridToPosition(384, 216));
            lc10.AddVertex(toCrane2p.position);
            lc10.ConvertEndPointToTarget(toCrane2p);
            toCrane2s.AddEvent(new EventTrigger(this, lc10));
            //393, 216
            //384, 216

            MovingPlatform crane2 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(343, 198)), Level.GridToPosition(new Point(343, 206)));
            FlipSwitch crane2switch = gsPlay.AddSwitch(new EventTrigger(this, crane2), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(350, 214)));     //crane 2 switch and platform
            LightningChain lc11 = gsPlay.AddLightning(crane2switch.position, GridToPosition(343, 214), Color.Red);
            lc11.AddVertex(crane2.position);
            lc11.ConvertEndPointToTarget(crane2);
            crane2switch.AddEvent(new EventTrigger(this, lc11));

            MovingPlatform crane3 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(252, 185)), Level.GridToPosition(new Point(267, 185)));
            FlipSwitch crane3switch = gsPlay.AddSwitch(new EventTrigger(this, crane3), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToCenterPosition(new Point(259, 178)) + new Vector2(0, -16));     //crane 3
            LightningChain lc12 = gsPlay.AddLightning(crane3switch.position, GridToCenterPosition(259,180), Color.Red);
            lc12.AddVertex(crane3.position);
            lc12.ConvertEndPointToTarget(crane3);
            crane3switch.AddEvent(new EventTrigger(this, lc12));

            Door d6 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(306, 177)), OpenState.Closed);
            FlipSwitch d6s = gsPlay.AddOnSwitch(new EventTrigger(this, d6), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(267, 183)));                       //door switch under crane 3
            LightningChain lc13 = gsPlay.AddLightning(d6s.position, GridToPosition(282, 183), Color.Red);
            lc13.AddVertex(GridToPosition(282, 168));
            lc13.AddVertex(GridToPosition(306, 168));
            lc13.AddVertex(GridToPosition(306, 175));
            d6s.AddEvent(new EventTrigger(this, lc13));
            lc13.defaultActive = true;
            lc13.SetActive(true);
            //267, 185
            //282, 185
            //282, 168
            //306, 168
            //306, 175

            d7 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(315, 177)), OpenState.Closed);                         //multiple fading doors 1
            d8 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(321, 177)), OpenState.Closed);
            d9 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(327, 177)), OpenState.Open);
            d10 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(333, 177)), OpenState.Open);
            FlipSwitch FS2 = gsPlay.AddMultiSwitch(new EventTrigger(this, 2), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(321, 172)));
            FlipSwitch FS3 = gsPlay.AddMultiSwitch(new EventTrigger(this, 3), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(327, 172)));
            LightningChain lc14 = gsPlay.AddLightning(FS2.position, GridToPosition(315, 174) + new Vector2(0, 16), Color.Red);
            lc14.AddVertex(GridToPosition(315, 174) + new Vector2(0, 32));
            FS2.AddEvent(new EventTrigger(this, lc14));
            LightningChain lc15 = gsPlay.AddLightning(FS3.position, GridToPosition(321, 174) + new Vector2(0, 16), Color.Red);
            lc15.AddVertex(GridToPosition(321, 174) + new Vector2(0, 32));
            FS3.AddEvent(new EventTrigger(this, lc15));
            LightningChain lc16 = gsPlay.AddLightning(FS2.position, GridToPosition(327, 174) + new Vector2(0, 16), Color.Red);
            lc16.AddVertex(GridToPosition(327, 174) + new Vector2(0, 32));
            FS2.AddEvent(new EventTrigger(this, lc16));
            lc14.defaultActive = true;
            lc14.SetActive(true);
            LightningChain lc17 = gsPlay.AddLightning(FS3.position, GridToPosition(333, 174) + new Vector2(0, 16), Color.Red);
            lc17.AddVertex(GridToPosition(333, 174) + new Vector2(0, 32));
            FS3.AddEvent(new EventTrigger(this, lc17));
            lc15.defaultActive = true;
            lc15.SetActive(true);

            Door d11 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(333, 171)), OpenState.Closed);
            FlipSwitch d11s = gsPlay.AddOnSwitch(new EventTrigger(this, d11), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(335, 178)));
            LightningChain lc18 = gsPlay.AddLightning(d11s.position, GridToPosition(333, 173) + new Vector2(0, 16), Color.Red);
            lc18.AddVertex(GridToPosition(333, 173) + new Vector2(0, 0));
            d11s.AddEvent(new EventTrigger(this, lc18));
            lc18.defaultActive = true;
            lc18.SetActive(true);

            gsPlay.AddCircularPlatform(Art.platform, Level.GridToPosition(new Point(275, 145)), 128, 240);    //circular platform 1
            CircularPlatform c1 = gsPlay.AddCircularPlatform(Art.platform, Level.GridToPosition(new Point(271, 137)), 128, 240);    //circular platform 2
            c1.increment = -c1.increment;
            gsPlay.AddCircularPlatform(Art.platform, Level.GridToPosition(new Point(275, 129)), 128, 240);    //circular platform 3

            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(300, 126)), Level.GridToPosition(new Point(319, 126)));       //slide under wind

            d12 = gsPlay.AddFadingDoor(Art.platform, Level.GridToPosition(new Point(341, 127)), OpenState.Closed);                               //fading platforms to portal item
            d13 = gsPlay.AddFadingDoor(Art.platform, Level.GridToPosition(new Point(354, 127)), OpenState.Open);
            FlipSwitch FS4 = gsPlay.AddMultiSwitch(new EventTrigger(this, 4), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToCenterPosition(new Point(347, 112)) + new Vector2(0, -16)); //multi-state!
            LightningChain lc19 = gsPlay.AddLightning(FS4.position, GridToCenterPosition(347, 114), Color.Red);
            lc19.AddVertex(d12.position);
            FS4.AddEvent(new EventTrigger(this, lc19));
            LightningChain lc20 = gsPlay.AddLightning(FS4.position, GridToCenterPosition(347, 114), Color.Red);
            lc20.AddVertex(d13.position);
            FS4.AddEvent(new EventTrigger(this, lc20));
            lc19.defaultActive = true;
            lc19.SetActive(true);

            Door d14 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(356, 111)), OpenState.Closed);                               //ease of access
            FlipSwitch d14s = gsPlay.AddOnSwitch(new EventTrigger(this, d14), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(360, 124)));
            LightningChain lc21 = gsPlay.AddLightning(d14s.position, GridToPosition(356, 113) + new Vector2(0, 16), Color.Red);
            lc21.AddVertex(GridToPosition(356, 113) + new Vector2(0, 0));
            d14s.AddEvent(new EventTrigger(this, lc21));
            lc21.defaultActive = true;
            lc21.SetActive(true);

            gsPlay.AddCircularPlatform(Art.platform, Level.GridToPosition(new Point(322, 95)), 256, 360);

            CircularPlatform c2 = gsPlay.AddActivateCircularPlatform(Art.platform, Level.GridToPosition(new Point(300, 98)), 256, 360);
            c2.increment = -c2.increment;
            FlipSwitch FS5 = gsPlay.AddSwitch(new EventTrigger(this, c2), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(322, 95)));
            FS5.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc22 = gsPlay.AddLightning(FS5.position, GridToPosition(322, 98), Color.Red);
            lc22.AddVertex(GridToPosition(300, 98));
            lc22.AddVertex(GridToPosition(300, 98));
            lc22.ConvertEndPointToTarget(c2);
            FS5.AddEvent(new EventTrigger(this, lc22));
            Moveable m3 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveableMechanical"), Level.GridToPosition(new Point(302, 97)), .8f);
            m3.SetPlayerMode(PlayerObjectMode.One);

            c3 = gsPlay.AddActivateCircularPlatform(Art.platform, Level.GridToPosition(new Point(342, 98)), 256, 360);
            c3.increment = -c3.increment;
            c3.SetPlayerMode(PlayerObjectMode.Two);
            c4 = gsPlay.AddActivateCircularPlatform(Art.platform, Level.GridToPosition(new Point(348, 98)), 256, 360);
            c4.angle = (float)Math.PI;
            c4.startAngle = c4.angle;
            c4.SetPlayerMode(PlayerObjectMode.One);

            c5 = gsPlay.AddActivateCircularPlatform(Art.platform, Level.GridToPosition(new Point(343 , 78)), 256, 360);
            c5.increment = -c5.increment;
            c5.SetPlayerMode(PlayerObjectMode.Two);
            c6 = gsPlay.AddActivateCircularPlatform(Art.platform, Level.GridToPosition(new Point(343, 78)), 256, 360);
            c5.angle = (float)Math.PI;
            c5.startAngle = c5.angle;
            c6.SetPlayerMode(PlayerObjectMode.One);

            Button b1 = gsPlay.AddButton(new EventTrigger(this, 5), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(287, 99)));
            //287, 87
            //343, 87
            //Down below: 343, 98
            LightningChain lc23 = gsPlay.AddLightning(b1.position, GridToPosition(287, 87), Color.Red);
            lc23.AddVertex(GridToPosition(343, 87));
            lc23.AddVertex(GridToPosition(343, 98));
            lc23.AddVertex(GridToPosition(342, 98));
            lc23.AddVertex(c3.position);
            lc23.ConvertEndPointToTarget(c3);
            b1.AddEvent(new EventTrigger(this, lc23));
            lc23.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc24 = gsPlay.AddLightning(b1.position, GridToPosition(287, 87), Color.Red);
            lc24.AddVertex(GridToPosition(343, 87));
            lc24.AddVertex(GridToPosition(343, 98));
            lc24.AddVertex(GridToPosition(348, 98));
            lc24.AddVertex(c4.position);
            lc24.ConvertEndPointToTarget(c4);
            b1.AddEvent(new EventTrigger(this, lc24));
            lc24.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lc25 = gsPlay.AddLightning(b1.position, GridToPosition(287, 87), Color.Red);
            lc25.AddVertex(GridToPosition(343, 87));
            lc25.AddVertex(GridToPosition(343, 78));
            lc25.AddVertex(c5.position);
            lc25.ConvertEndPointToTarget(c5);
            b1.AddEvent(new EventTrigger(this, lc25));
            lc25.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc26 = gsPlay.AddLightning(b1.position, GridToPosition(287, 87), Color.Red);
            lc26.AddVertex(GridToPosition(343, 87));
            lc26.AddVertex(GridToPosition(343, 78));
            lc26.AddVertex(c6.position);
            lc26.ConvertEndPointToTarget(c6);
            b1.AddEvent(new EventTrigger(this, lc26));
            lc26.SetPlayerMode(PlayerObjectMode.One);

            Door p4 = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(80, 116)), Level.GridToPosition(new Point(80, 113)), OpenState.Closed);
            gsPlay.AddBouncyBall(0, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(80, 112)));

            Door p5 = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(82, 116)), Level.GridToPosition(new Point(82, 113)), OpenState.Closed);
            gsPlay.AddBouncyBall(0, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(82, 112)));

            p1 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(376, 126)), Level.GridToPosition(new Point(402, 126)));
            p1.SetPlayerMode(PlayerObjectMode.One);

            p2 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(376, 120)), Level.GridToPosition(new Point(402, 120)));
            p2.SetPlayerMode(PlayerObjectMode.Two);

            Button b2 = gsPlay.AddButton(new EventTrigger(this, p1), 2, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(81, 115)));
            b2.AddEvent(new EventTrigger(this, p2));

            FlipSwitch FS6 = gsPlay.AddSwitch(new EventTrigger(this, p4), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(376, 118)));
            FS6.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lcpuzzle1 = gsPlay.AddLightning(FS6.position, p2.position, Color.Aqua);
            lcpuzzle1.AddVertex(p1.position);
            lcpuzzle1.ConvertEndPointToTarget(p2);
            FS6.AddEvent(new EventTrigger(this, lcpuzzle1));

            FlipSwitch FS7 = gsPlay.AddSwitch(new EventTrigger(this, p5), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(376, 124)));
            FS7.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lcpuzzle2 = gsPlay.AddLightning(FS7.position, p1.position, Color.Orange);
            lcpuzzle2.AddVertex(p1.position);
            lcpuzzle2.ConvertEndPointToTarget(p1);
            FS7.AddEvent(new EventTrigger(this, lcpuzzle2));

            MovingPlatform p3 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(359, 44)), Level.GridToPosition(new Point(380, 44)));

            Door p6 = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(90, 116)), Level.GridToPosition(new Point(90, 113)), OpenState.Closed);
            gsPlay.AddBouncyBall(0, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(90, 112)));

            Door p7 = gsPlay.AddOpeningDoor(Art.platform, Level.GridToPosition(new Point(92, 116)), Level.GridToPosition(new Point(92, 113)), OpenState.Closed);
            gsPlay.AddBouncyBall(0, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(92, 112)));

            Button b3 = gsPlay.AddButton(new EventTrigger(this, p3), 2, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(91, 115)));

            FlipSwitch FS8 = gsPlay.AddSwitch(new EventTrigger(this, p6), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(355, 42)));
            FS8.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lcfinal1 = gsPlay.AddLightning(FS8.position, p3.position, Color.Aqua);
            lcfinal1.ConvertEndPointToTarget(p3);
            FS8.AddEvent(new EventTrigger(this, lcfinal1));

            FlipSwitch FS9 = gsPlay.AddSwitch(new EventTrigger(this, p7), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(355, 42)));
            FS9.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lcfinal2 = gsPlay.AddLightning(FS9.position, p3.position, Color.Orange);
            lcfinal2.ConvertEndPointToTarget(p3);
            FS9.AddEvent(new EventTrigger(this, lcfinal2));

            AudioManager.PlayMusic("Construction");
        }
Example #2
0
        public Level1(GSPlay gsPlay)
            : base(gsPlay)
        {
            levelDataTexture = gsPlay.LoadTexture("Levels/level1Data");

            player1Pos = GridToPosition(42, 25);
            player2Pos = GridToPosition(40, 25);

            //player1Pos = GridToPosition(673, 20);
            //player2Pos = player1Pos;

            portalPos = GridToPosition(681, 20);
            pItemPos = GridToPosition(672, 11);

            SetupLevel();

            leftLimit = 32;
            rightLimit = levelWidth - 32;

            gsPlay.cameraPlayer1.Update();
            gsPlay.cameraPlayer2.Update();

            gsPlay.cameraPlayer1.SnapToTarget();
            gsPlay.cameraPlayer2.SnapToTarget();

            //Deactivate players for intro scene:
            StartIntro();

            Vector2 bgPosition = new Vector2(-500, -500);
            for (int x = 0; x < 34; x++)
            {
                SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldBackdropBase1"), bgPosition);
                bg1.SetPlayerMode(PlayerObjectMode.One);
                gsPlay.AddParallax(bg1, .1f);
                SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldBackdropBase2"), bgPosition);
                bg2.SetPlayerMode(PlayerObjectMode.Two);
                gsPlay.AddParallax(bg2, .1f);

                bgPosition.X += 1024;
            }

            bgPosition = new Vector2(-800, -500);
            for (int x = 0; x < 6; x++)
            {
                SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldBackdropOverlay1"), bgPosition);
                bg1.SetPlayerMode(PlayerObjectMode.One);
                gsPlay.AddParallax(bg1, .2f);
                SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldBackdropOverlay2"), bgPosition);
                bg2.SetPlayerMode(PlayerObjectMode.Two);
                gsPlay.AddParallax(bg2, .2f);

                bgPosition.X += 1024;
            }

            bgPosition = new Vector2(-300, -300);
            for (int x = 0; x < 11; x++)
            {
                SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldMatte1"), bgPosition);
                bg1.SetPlayerMode(PlayerObjectMode.One);
                gsPlay.AddParallax(bg1, .5f);
                SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/fieldMatte2"), bgPosition);
                bg2.SetPlayerMode(PlayerObjectMode.Two);
                gsPlay.AddParallax(bg2, .5f);

                bgPosition.X += 1024;
            }

            //672, 13
            gsPlay.AddBGWarmGear(gsPlay.LoadTexture("GameObjects/gearWarm3"), GridToCenterPosition(672, 13), .75f, .02f, 1);
            gsPlay.AddBGCoolGear(gsPlay.LoadTexture("GameObjects/gearCool3"), GridToCenterPosition(672, 13), .75f, .02f, 1);

            for (int x = 1; x <= 22; x++)
            {
                for (int y = 1; y <= 1; y++)
                {
                    string fgName = "LevelTiles/Field/fieldCoolFG" + x + "x" + y;
                    if (File.Exists("Content/" + fgName + ".xnb"))
                    {
                        SpriteIMG fg = gsPlay.AddFrontFGTile(gsPlay.LoadTexture(fgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        fg.origin = Vector2.Zero;
                        fg.SetPlayerMode(PlayerObjectMode.Two);
                    }

                    string bgName = "LevelTiles/Field/fieldCoolBG" + x + "x" + y;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.Two);
                    }

                }
            }

            for (int x = 1; x <= 22; x++)
            {
                for (int y = 1; y <= 1; y++)
                {
                    string fgName = "LevelTiles/Field/fieldWarmFG" + x + "x" + y;
                    if (File.Exists("Content/" + fgName + ".xnb"))
                    {
                        SpriteIMG fg = gsPlay.AddFrontFGTile(gsPlay.LoadTexture(fgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        fg.origin = Vector2.Zero;
                        fg.SetPlayerMode(PlayerObjectMode.One);

                    }

                    string bgName = "LevelTiles/Field/fieldWarmBG" + x + "x" + y;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.One);
                    }

                }
            }

            TriggerArea update = gsPlay.AddTriggerArea(new EventTrigger(this, 99), Art.barrier, Vector2.Zero);

            atmosphereLight = new Color(255, 255, 255);

            doubleButtonDoor = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(214, 23)), Level.GridToPosition(new Point(214, 27)), OpenState.Closed);  //first door puzzle
            Button b1 = gsPlay.AddButton(new EventTrigger(this, 1), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(206, 29)));                                            //first door puzzle
            Button b2 = gsPlay.AddButton(new EventTrigger(this, 2), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(222, 29)));                                            //first door puzzle
            LightningChain lc1 = gsPlay.AddLightning(b1.position, doubleButtonDoor.position, Color.Green);
            lc1.ConvertEndPointToTarget(doubleButtonDoor);
            b1.AddEvent(new EventTrigger(this, lc1));
            LightningChain lc2 = gsPlay.AddLightning(b2.position, doubleButtonDoor.position, Color.Green);
            lc2.ConvertEndPointToTarget(doubleButtonDoor);
            b2.AddEvent(new EventTrigger(this, lc2));
            //lc3.AddVertex(GridToPosition(103, 46) + new Vector2(0, 16));
            //gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(222, 16)));

            Door d2 = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(305, 23)), Level.GridToPosition(new Point(305, 27)), OpenState.Closed);  //jump from box, ball on button
            Button b3 = gsPlay.AddButton(new EventTrigger(this, d2), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(297, 29)));                                            //jump from box, ball on button
            gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(257, 16)), .8f);                                                                  //jump from box, ball on button
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(280, 16)));                                                                  //jump from box, ball on button
            LightningChain lc3 = gsPlay.AddLightning(b3.position, d2.position, Color.Green);
            lc3.ConvertEndPointToTarget(d2);
            b3.AddEvent(new EventTrigger(this, lc3));

            Door d3 = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(329, 23)), Level.GridToPosition(new Point(329, 27)), OpenState.Closed);  //throw ball onto button
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(312, 16)));                                                                  //throw ball onto button
            Button b4 = gsPlay.AddButton(new EventTrigger(this, d3), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(326, 22)));                                            //throw ball onto button
            LightningChain lc4 = gsPlay.AddLightning(b4.position, d3.position, Color.Green);
            lc4.ConvertEndPointToTarget(d3);
            b4.AddEvent(new EventTrigger(this, lc4));

            Door d4 = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(373, 23)), Level.GridToPosition(new Point(373, 27)), OpenState.Closed);  //box drop
            gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(339, 16)), .8f);                                                                  //box drop
            gsPlay.AddBouncyBall(.8f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(358, 16)));                                                                   //box drop
            Button b5 = gsPlay.AddButton(new EventTrigger(this, d4), 2, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(365, 29)));                                            //box drop
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(370, 16)));                                                                  //box drop
            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(351, 21)), Level.GridToPosition(new Point(346, 21)));                             //box drop
            LightningChain lc5 = gsPlay.AddLightning(b5.position, d4.position, Color.Green);
            lc5.ConvertEndPointToTarget(d4);
            b5.AddEvent(new EventTrigger(this, lc5));

            gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(378, 16)), .8f);                                                                  //box accross moving
            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(398, 25)), Level.GridToPosition(new Point(406, 25)));                             //box accross moving
            gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(386, 25)), Level.GridToPosition(new Point(386, 30)));                             //box accross moving

            Door d5 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(561, 24)), OpenState.Closed);                                             //barn door
            FlipSwitch s1 = gsPlay.AddOnSwitch(new EventTrigger(this, d5), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(556, 25)));                                               //barn door
            LightningChain lc6 = gsPlay.AddLightning(s1.position, GridToPosition(556, 26) + new Vector2(0, 16), Color.Green);
            lc6.AddVertex(GridToPosition(561, 26) + new Vector2(0, 16));
            lc6.AddVertex(GridToPosition(561, 26) + new Vector2(0, 0));
            //lc6.ConvertEndPointToTarget(d5);
            s1.AddEvent(new EventTrigger(this, lc6));
            lc6.defaultActive = true;
            lc6.SetActive(true);

            Door d6 = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(570, 15)), Level.GridToPosition(new Point(570, 23)), OpenState.Closed);
            Button b6 = gsPlay.AddButton(new EventTrigger(this, d6), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(573, 19)));
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), Level.GridToPosition(new Point(564, 24)));
            LightningChain lc7 = gsPlay.AddLightning(b6.position, d6.position, Color.Green);
            lc7.ConvertEndPointToTarget(d6);
            b6.AddEvent(new EventTrigger(this, lc7));

            Door d7 = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(576, 23)), Level.GridToPosition(new Point(576, 17)), OpenState.Closed);
            Button b7 = gsPlay.AddButton(new EventTrigger(this, d7), 1, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(579, 19)));
            LightningChain lc8 = gsPlay.AddLightning(b7.position, d7.position, Color.Green);
            lc8.ConvertEndPointToTarget(d7);
            b7.AddEvent(new EventTrigger(this, lc8));

            gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(579, 22)), .8f);
            //gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(635, 06)), Level.GridToPosition(new Point(635, 25)));
            MovingPlatform p1 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(595, 06)), Level.GridToPosition(new Point(595, 25)));
            FlipSwitch s2 = gsPlay.AddSwitch(new EventTrigger(this, p1), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(602, 25)));
            LightningChain lc9 = gsPlay.AddLightning(s2.position, GridToPosition(595, 25), Color.Green);
            lc9.AddVertex(p1.position);
            lc9.ConvertEndPointToTarget(p1);
            s2.AddEvent(new EventTrigger(this, lc9));

            Door d8 = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(605, 18)), OpenState.Closed);                                                //lower barn exit
            FlipSwitch s3 = gsPlay.AddOnSwitch(new EventTrigger(this, d8), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(601, 19)));                                  //lower barn exit
            LightningChain lc10 = gsPlay.AddLightning(s3.position, GridToPosition(601, 20) + new Vector2(0, 16), Color.Green);
            lc10.AddVertex(GridToPosition(605, 20) + new Vector2(0, 16));
            lc10.AddVertex(GridToPosition(605, 20) + new Vector2(0, 0));
            //lc6.ConvertEndPointToTarget(d5);
            s3.AddEvent(new EventTrigger(this, lc10));
            lc10.defaultActive = true;
            lc10.SetActive(true);

            finalTrapDoor = gsPlay.AddOpeningDoor(Art.door, Level.GridToPosition(new Point(600, 28)), Level.GridToPosition(new Point(600, 24)), OpenState.Closed);
            Button finalButton = gsPlay.AddButton(new EventTrigger(this, finalTrapDoor), 2, gsPlay.LoadTexture("TestSprites/button"), Level.GridToPosition(new Point(591, 26)));
            LightningChain lc11 = gsPlay.AddLightning(finalButton.position, GridToPosition(600, 26), Color.Green);
            lc11.AddVertex(finalTrapDoor.position);
            lc11.ConvertEndPointToTarget(finalTrapDoor);
            finalButton.AddEvent(new EventTrigger(this, lc11));

            finalTopDoor = gsPlay.AddFadingDoor(Art.door, Level.GridToPosition(new Point(605, 09)), OpenState.Closed);                                                //upper barn exit
            FlipSwitch finalSwitch = gsPlay.AddOnSwitch(new EventTrigger(this, finalTopDoor), gsPlay.LoadTexture("TestSprites/switch"), Level.GridToPosition(new Point(601, 10)));                    //upper barn exit
            finalSwitch.AddEvent(new EventTrigger(this, 4));
            LightningChain lc12 = gsPlay.AddLightning(finalSwitch.position, GridToPosition(601, 11) + new Vector2(0, 16), Color.Green);
            lc12.AddVertex(GridToPosition(605, 11) + new Vector2(0, 16));
            lc12.AddVertex(GridToPosition(605, 11) + new Vector2(0, 0));
            //lc6.ConvertEndPointToTarget(d5);
            finalSwitch.AddEvent(new EventTrigger(this, lc12));
            lc12.defaultActive = true;
            lc12.SetActive(true);

            AudioManager.PlayMusic("Field");
        }
Example #3
0
        public Level2(GSPlay gsPlay)
            : base(gsPlay)
        {
            levelDataTexture = gsPlay.LoadTexture("Levels/level2Data");

            player1Pos = GridToPosition(26, 85);
            player2Pos = GridToPosition(22, 85);

            //player1Pos = GridToPosition(339, 52);
            //player2Pos = player1Pos;

            portalPos = GridToPosition(457, 67);
            pItemPos = GridToPosition(241, 79);

            renderCollision = false;

            SetupLevel();

            Vector2 bgPosition = new Vector2(-400, -350);
            for (int x = 0; x < 3; x++)
            {
                SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestBackdropBase1"), bgPosition);
                bg1.SetPlayerMode(PlayerObjectMode.One);
                gsPlay.AddParallax(bg1, .1f);
                SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestBackdropBase2"), bgPosition);
                bg2.SetPlayerMode(PlayerObjectMode.Two);
                gsPlay.AddParallax(bg2, .1f);

                bgPosition.X += 1024;
            }

            bgPosition = new Vector2(-300, -200);
            for (int x = 0; x < 4; x++)
            {
                SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestBackdropOverlay1"), bgPosition);
                bg1.SetPlayerMode(PlayerObjectMode.One);
                gsPlay.AddParallax(bg1, .2f);
                SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestBackdropOverlay2"), bgPosition);
                bg2.SetPlayerMode(PlayerObjectMode.Two);
                gsPlay.AddParallax(bg2, .2f);

                bgPosition.X += 1024;
            }

            bgPosition = new Vector2(-300, -300);
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestMatte1"), bgPosition);
                    bg1.SetPlayerMode(PlayerObjectMode.One);
                    gsPlay.AddParallax(bg1, .5f);
                    SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/forestMatte2"), bgPosition);
                    bg2.SetPlayerMode(PlayerObjectMode.Two);
                    gsPlay.AddParallax(bg2, .5f);

                    bgPosition.Y += 1024;
                }

                bgPosition.Y = -300;
                bgPosition.X += 1024;
            }

            gsPlay.AddBGWarmGear(gsPlay.LoadTexture("GameObjects/gearWarm1"), GridToCenterPosition(239, 76), .75f, .02f, 1);
            gsPlay.AddBGCoolGear(gsPlay.LoadTexture("GameObjects/gearCool1"), GridToCenterPosition(239, 76), .75f, .02f, 1);
            gsPlay.AddBGWarmGear(gsPlay.LoadTexture("GameObjects/gearWarm2"), GridToCenterPosition(242, 80), .5f, -.03f, 1);
            gsPlay.AddBGCoolGear(gsPlay.LoadTexture("GameObjects/gearCool2"), GridToCenterPosition(242, 80), .5f, -.03f, 1);

            for (int x = 1; x <= 16; x++)
            {
                for (int y = 1; y <= 4; y++)
                {
                    string fgName = "LevelTiles/Forest/forestCoolFG" + x + "x" + y;
                    if (File.Exists("Content/" + fgName + ".xnb"))
                    {
                        SpriteIMG fg = gsPlay.AddFrontFGTile(gsPlay.LoadTexture(fgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        fg.origin = Vector2.Zero;
                        fg.SetPlayerMode(PlayerObjectMode.Two);
                    }

                    string bgName = "LevelTiles/Forest/forestCoolBG" + x + "x" + y;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.Two);
                    }

                }
            }

            for (int x = 1; x <= 16; x++)
            {
                for (int y = 1; y <= 4; y++)
                {
                    string fgName = "LevelTiles/Forest/forestWarmFG" + x + "x" + y;
                    if (File.Exists("Content/" + fgName + ".xnb"))
                    {
                        SpriteIMG fg = gsPlay.AddFrontFGTile(gsPlay.LoadTexture(fgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        fg.origin = Vector2.Zero;
                        fg.SetPlayerMode(PlayerObjectMode.One);

                    }

                    string bgName = "LevelTiles/Forest/forestWarmBG" + x + "x" + y;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                        bg.SetPlayerMode(PlayerObjectMode.One);
                    }

                }
            }

            rightLimit = levelWidth;

            Sprite cameraTarget = new Sprite(GridToPosition(137, 86));
            gsPlay.cameraPlayer1.AddTarget(cameraTarget);
            gsPlay.cameraPlayer2.AddTarget(cameraTarget);

            cameraTarget = new Sprite(GridToPosition(201, 83));
            gsPlay.cameraPlayer1.AddTarget(cameraTarget);
            gsPlay.cameraPlayer2.AddTarget(cameraTarget);

            atmosphereLight = new Color(150, 150, 150);

            //puzzle 1
            Door d1 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorMidWarm"), GridToPosition(new Point(101, 87)), OpenState.Closed, new Vector2(3, -20), new Vector2(128));
            d1.SetPlayerMode(PlayerObjectMode.One);
            Button bb1 = gsPlay.AddButton(new EventTrigger(this, d1), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(105, 81)));
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(137, 46))).selfIlluminating = true;
            LightningChain lc1 = gsPlay.AddLightning(GridToPosition(new Point(105, 81)), GridToPosition(101, 81), Color.Green);
            lc1.AddVertex(d1.position + new Vector2(0,-64));
            bb1.AddEvent(new EventTrigger(this, lc1));
            lc1.defaultActive = true;
            lc1.SetActive(true);

            //puzzle 2

            //puzzle 3
            MovingPlatform p11 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(201, 84)), Level.GridToPosition(new Point(201, 84)));
            p11.SetPlayerMode(PlayerObjectMode.One);
            MovingPlatform p12 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(201, 90)), Level.GridToPosition(new Point(201, 84)));
            FlipSwitch ss1 = gsPlay.AddSwitch(new EventTrigger(this, p12), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(212, 81)));
            LightningChain lc2 = gsPlay.AddLightning(ss1.position, GridToPosition(212, 90), Color.Green);
            lc2.AddVertex(GridToPosition(201, 90));
            lc2.AddVertex(p12.position);
            lc2.ConvertEndPointToTarget(p12);
            ss1.AddEvent(new EventTrigger(this, lc2));

            //Moveable m1 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(211, 81)), .8f);
            //Moveable m2 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(201, 84)), .8f);
            //m2.SetPlayerMode(PlayerObjectMode.One);

            //puzzle 4
            Door d2 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorLargeWarm"), GridToPosition(new Point(241, 84)), OpenState.Closed, new Vector2(1,-39), new Vector2(192, 128));
            gsPlay.frontFGList.Add(d2.AddCoolTile(gsPlay.LoadTexture("TestSprites/forestDoorLargeCool")));
            Button bb2 = gsPlay.AddButton(new EventTrigger(this, d2), 2, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(236, 77)));
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(226, 49))).selfIlluminating = true;
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(238, 55))).selfIlluminating = true;
            LightningChain lc3 = gsPlay.AddLightning(bb2.position, GridToCenterPosition(238, 77) + new Vector2(0, -16), Color.Green);
            lc3.AddVertex(GridToCenterPosition(238, 81));
            lc3.AddVertex(GridToCenterPosition(241, 81) + new Vector2(-16, 0));
            lc3.AddVertex(GridToCenterPosition(241, 81) + new Vector2(-16, 16));
            bb2.AddEvent(new EventTrigger(this, lc3));
            lc3.defaultActive = true;
            lc3.SetActive(true);

            //puzzle 5
            Moveable m3 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(261, 85)), .8f);
            m3.SetPlayerMode(PlayerObjectMode.Two);
            Moveable m4 = gsPlay.AddMoveable(gsPlay.LoadTexture("TestSprites/moveable"), Level.GridToPosition(new Point(282, 76)), .8f);

            doubleButtonDoor = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorMidWarm"), GridToPosition(new Point(315, 78)), OpenState.Closed, new Vector2(3, -20), new Vector2(128));
            gsPlay.frontFGList.Add(doubleButtonDoor.AddCoolTile(gsPlay.LoadTexture("TestSprites/forestDoorMidCool")));

            Button bb3 = gsPlay.AddButton(new EventTrigger(this, 77), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(308, 80)));
            Button bb4 = gsPlay.AddButton(new EventTrigger(this, 78), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(321, 80)));
            bb3.SetPlayerMode(PlayerObjectMode.One);
            bb4.SetPlayerMode(PlayerObjectMode.Two);

            LightningChain lc4 = gsPlay.AddLightning(GridToPosition(new Point(308, 80)), GridToPosition(new Point(315, 82)), Color.Yellow);
            bb3.AddEvent(new EventTrigger(this, lc4));
            lc4.defaultActive = true;
            lc4.SetActive(true);

            LightningChain lc5 = gsPlay.AddLightning(GridToPosition(new Point(321, 80)), GridToPosition(new Point(315, 82)), Color.Blue);
            bb4.AddEvent(new EventTrigger(this, lc5));
            lc5.defaultActive = true;
            lc5.SetActive(true);

            lc6 = gsPlay.AddLightning(GridToPosition(315, 82), GridToPosition(315, 80), Color.Green);
            lc6.SetActive(true);

            //secret puzzle
            MovingPlatform p4 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(259, 63)), Level.GridToPosition(new Point(278, 63)));

            //red platforms
            MovingPlatform p5 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(272, 50)), Level.GridToPosition(new Point(272, 59)));
            p5.SetPlayerMode(PlayerObjectMode.One);
            MovingPlatform p6 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(278, 48)), Level.GridToPosition(new Point(289, 48)));
            p6.SetPlayerMode(PlayerObjectMode.One);
            MovingPlatform p7 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(304, 38)), Level.GridToPosition(new Point(297, 45)));
            p7.SetPlayerMode(PlayerObjectMode.One);

            //blue platforms
            MovingPlatform p8 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(284, 50)), Level.GridToPosition(new Point(284, 59)));
            p8.SetPlayerMode(PlayerObjectMode.Two);
            MovingPlatform p9 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(278, 48)), Level.GridToPosition(new Point(267, 48)));
            p9.SetPlayerMode(PlayerObjectMode.Two);
            MovingPlatform p10 = gsPlay.AddPlatform(Art.platform, Level.GridToPosition(new Point(252, 38)), Level.GridToPosition(new Point(259, 45)));
            p10.SetPlayerMode(PlayerObjectMode.Two);

            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(245, 32))).selfIlluminating = true;
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(312, 32))).selfIlluminating = true;

            Door d5 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorRight"), GridToPosition(new Point(243, 79)) + new Vector2(16,0), OpenState.Closed, new Vector2(-2,10), new Vector2(32, 128));
            gsPlay.frontFGList.Add(d5.AddCoolTile(gsPlay.LoadTexture("TestSprites/forestDoorRightCool")));
            Button bb6 = gsPlay.AddButton(new EventTrigger(this, d5), 2, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(278, 39)));
            LightningChain lc7 = gsPlay.AddLightning(bb6.position, bb6.position + new Vector2(0, 16), Color.Red);
            lc7.AddVertex(GridToCenterPosition(243, 39));
            lc7.AddVertex(GridToCenterPosition(243, 76) + new Vector2(0, 16));
            bb6.AddEvent(new EventTrigger(this, lc7));
            lc7.defaultActive = true;
            lc7.SetActive(true);

            //6
            //Door d6 = gsPlay.AddFadingDoor(Art.door, GridToPosition(new Point(342, 52)) + new Vector2(-16, 0), OpenState.Closed);
            //gsPlay.AddButton(new EventTrigger(this, d6), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(97, 10)));
            //Door d7 = gsPlay.AddFadingDoor(Art.door, GridToPosition(new Point(337, 34)) + new Vector2(-16, 0), OpenState.Closed);
               // d7.SetPlayerMode(PlayerObjectMode.One);
            //Button b2 = gsPlay.AddButton(new EventTrigger(this, d7), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(339, 55)));
            //b2.SetPlayerMode(PlayerObjectMode.Two);

            //blockers
            //Door d9 = gsPlay.AddFadingDoor(Art.door, GridToPosition(new Point(337, 52)) + new Vector2(-16, 0), OpenState.Closed);
            //d9.SetPlayerMode(PlayerObjectMode.Two);
            //Door d8 = gsPlay.AddFadingDoor(Art.door, GridToPosition(new Point(342, 52)) + new Vector2(-16, 0), OpenState.Closed);
            //d8.SetPlayerMode(PlayerObjectMode.One);
            //or gate

            //MovingPlatform p13 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(96, 10)), Level.GridToPosition(new Point(96, 12)));
            //Button b1 = gsPlay.AddButton(new EventTrigger(this, p13), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(339, 55)));
            //b1.SetPlayerMode(PlayerObjectMode.One);
            //MovingPlatform p14 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(99, 10)), Level.GridToPosition(new Point(99, 12)));
            //gsPlay.AddButton(new EventTrigger(this, p14), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(339, 44)));
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(97, 9))).selfIlluminating = true;
            gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(98, 9))).selfIlluminating = true;

            //part2
            Door d10 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorLeft"), GridToPosition(new Point(362, 74)) + new Vector2(-16, 0), OpenState.Closed, new Vector2(4,10), new Vector2(32, 128));
            d10.SetPlayerMode(PlayerObjectMode.One);
            Door d11 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorLeftCool"), GridToPosition(new Point(362, 27)) + new Vector2(-16, 0), OpenState.Closed, new Vector2(4, 10), new Vector2(32, 128));
            d11.SetPlayerMode(PlayerObjectMode.Two);

            //64 40

            Door d14 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorRightCool"), GridToPosition(new Point(367, 27)) + new Vector2(-16, 0), OpenState.Closed, new Vector2(-2, 10), new Vector2(32, 128));
            d14.SetPlayerMode(PlayerObjectMode.Two);
            //NEEDS TO BE TIMED!!!
            FlipSwitch s1 = gsPlay.AddOnSwitch(new EventTrigger(this, d14), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(364, 40)));
            s1.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lc8 = gsPlay.AddLightning(s1.position, GridToPosition(367, 40) + new Vector2(-16, 0), Color.Yellow);
            lc8.AddVertex(d14.position + new Vector2(0, 64));
            s1.AddEvent(new EventTrigger(this, lc8));
            lc8.defaultActive = true;
            lc8.SetActive(true);

            Door d15 = gsPlay.AddFrontFadingDoor(gsPlay.LoadTexture("TestSprites/forestDoorRight"), GridToPosition(new Point(367, 74)) + new Vector2(-16, 0), OpenState.Closed, new Vector2(-2, 10), new Vector2(32, 128));
            d15.SetPlayerMode(PlayerObjectMode.One);
            //NEEDS TO BE TIMED!!!
            FlipSwitch s2 = gsPlay.AddOnSwitch(new EventTrigger(this, d15), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(364, 65)));
            s2.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc9 = gsPlay.AddLightning(s2.position, GridToPosition(367, 65) + new Vector2(-16, 0), Color.Blue);
            lc9.AddVertex(d15.position + new Vector2(0, -64));
            s2.AddEvent(new EventTrigger(this, lc9));
            lc9.defaultActive = true;
            lc9.SetActive(true);

            //Add Front FG Tile to Cover bottom of Player One doors
            gsPlay.AddFrontFGTile(gsPlay.LoadTexture("TestSprites/treeTrunkBottomWarm"), GridToPosition(364, 76) + new Vector2(0, 16)).SetPlayerMode(PlayerObjectMode.One);

            PickUpObj o1 = gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(364, 28)));
            o1.SetPlayerMode(PlayerObjectMode.Two);
            PickUpObj o2 = gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(364, 75)));
            o2.SetPlayerMode(PlayerObjectMode.One);

            MovingPlatform d12 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(389, 42)) + new Vector2(-16, 0), Level.GridToPosition(new Point(389, 40)) + new Vector2(-16, 0));
            MovingPlatform d23 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(390, 46)) + new Vector2(-16, 0), Level.GridToPosition(new Point(390, 48)) + new Vector2(-16, 0));
            //d12.SetPlayerMode(PlayerObjectMode.Two);
            Button b3 = gsPlay.AddButton(new EventTrigger(this, d12), .5f, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(391, 36)));
            b3.AddEvent(new EventTrigger(this, d23));
            b3.SetPlayerMode(PlayerObjectMode.One);
            LightningChain lc10 = gsPlay.AddLightning(b3.position, GridToPosition(389, 36), Color.Yellow);
            lc10.AddVertex(d12.position + new Vector2(16, 0));
            b3.AddEvent(new EventTrigger(this, lc10));

            MovingPlatform d13 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(389, 46)) + new Vector2(-16, 0), Level.GridToPosition(new Point(389, 48)) + new Vector2(-16, 0));
            MovingPlatform d22 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(390, 42)) + new Vector2(-16, 0), Level.GridToPosition(new Point(390, 40)) + new Vector2(-16, 0));
            //d13.SetPlayerMode(PlayerObjectMode.One);
            Button b4 = gsPlay.AddButton(new EventTrigger(this, d13), .5f, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(391, 60)));
            b4.AddEvent(new EventTrigger(this, d22));
            b4.SetPlayerMode(PlayerObjectMode.Two);
            LightningChain lc11 = gsPlay.AddLightning(b4.position, GridToPosition(389, 60), Color.Blue);
            lc11.AddVertex(d13.position + new Vector2(16, 0));
            b4.AddEvent(new EventTrigger(this, lc11));

            //MovingPlatform d22 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(390, 42)) + new Vector2(-16, 0), Level.GridToPosition(new Point(390, 40)) + new Vector2(-16, 0));
            ////d12.SetPlayerMode(PlayerObjectMode.Two);
            //Button b5 = gsPlay.AddButton(new EventTrigger(this, d22), .5f, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(391, 60)));
            //b5.SetPlayerMode(PlayerObjectMode.Two);
            //MovingPlatform d23 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(390, 46)) + new Vector2(-16, 0), Level.GridToPosition(new Point(390, 48)) + new Vector2(-16, 0));
            ////d13.SetPlayerMode(PlayerObjectMode.One);
            //Button b6 = gsPlay.AddButton(new EventTrigger(this, d23), .5f, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(391, 36)));
            //b6.SetPlayerMode(PlayerObjectMode.One);

            //MovingPlatform p15 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(367, 49)) + new Vector2(-16, 0), Level.GridToPosition(new Point(367, 47)) + new Vector2(-16, 0));
            //FlipSwitch b5 = gsPlay.AddSwitch(new EventTrigger(this, p15), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(365, 45)));
            //b5.pressureCooker = true;
            //MovingPlatform p16 = gsPlay.AddReversePlatform(Art.door, Level.GridToPosition(new Point(367, 53)) + new Vector2(-16, 0), Level.GridToPosition(new Point(367, 55)) + new Vector2(-16, 0));
            //FlipSwitch b6 = gsPlay.AddSwitch(new EventTrigger(this, p16), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(365, 60)));
            //b6.pressureCooker = true;

            //gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(294, 70))).selfIlluminating = true;

            ////and gate
            //MovingPlatform p17 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(370, 34)), Level.GridToPosition(new Point(370, 36)));
            //FlipSwitch b8 = gsPlay.AddSwitch(new EventTrigger(this, p17), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(365, 45)));
            //b8.pressureCooker = true;
            ////b8.SetPlayerMode(PlayerObjectMode.One);
            //MovingPlatform p18 = gsPlay.AddReversePlatform(Art.platform, Level.GridToPosition(new Point(370, 34)), Level.GridToPosition(new Point(370, 36)));
            //FlipSwitch b9 = gsPlay.AddSwitch(new EventTrigger(this, p18), gsPlay.LoadTexture("TestSprites/switch"), GridToPosition(new Point(365, 60)));
            //b9.pressureCooker = true;
            ////b9.SetPlayerMode(PlayerObjectMode.Two);

            //gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(370, 33))).selfIlluminating = true;

            //Door d17 = gsPlay.AddFadingDoor(Art.platform, GridToPosition(new Point(375, 34)), OpenState.Closed);
            //gsPlay.AddButton(new EventTrigger(this, d17), 1, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(370, 35)));
            //gsPlay.AddBouncyBall(.5f, gsPlay.LoadTexture("TestSprites/pickUp"), GridToPosition(new Point(375, 33))).selfIlluminating = true;

            //end door

            //Door d16 = gsPlay.AddFadingDoor(gsPlay.LoadTexture("TestSprites/doorThick"), GridToPosition(new Point(390, 44)), OpenState.Closed);
            //Button b7 = gsPlay.AddButton(new EventTrigger(this, d16), 2, gsPlay.LoadTexture("TestSprites/button"), GridToPosition(new Point(364, 53)));

            //364, 53
            //Button (365, 45)
            //Button (365, 60)

            //672,11

            AudioManager.PlayMusic("Forest");
        }