Пример #1
0
        public void Update(Player player)
        {
            // Save previous keyboard/gamepad states
            previousKeyboardState = currentKeyboardState;
            previousGamepadState = currentGamepadState;

            // Read current keyboard/gamepad
            currentKeyboardState = Keyboard.GetState();
            currentGamepadState = GamePad.GetState(PlayerIndex.One);

            // Bools for simpler looking conditions
            bool left = currentKeyboardState.IsKeyDown(Keys.Left) || currentGamepadState.ThumbSticks.Left.X < 0;
            bool right = currentKeyboardState.IsKeyDown(Keys.Right) || currentGamepadState.ThumbSticks.Left.X > 0;
            bool up = currentKeyboardState.IsKeyDown(Keys.Up) || currentGamepadState.ThumbSticks.Left.Y < 0;
            bool down = currentKeyboardState.IsKeyDown(Keys.Down) || currentGamepadState.ThumbSticks.Left.Y > 0;

            // Movement Combination
            if (left && !up && !down)
                player.Move(new Vector2(-1, 0));
            else if (right && !up && !down)
                player.Move(new Vector2(1, 0));
            if (up && !left && !right)
                player.Move(new Vector2(0, -1));
            else if (down && !left && !right)
                player.Move(new Vector2(0, 1));
            else if (up && left)
                player.Move(new Vector2(-1, -1));
            else if (up && right)
                player.Move(new Vector2(1, -1));
            else if (down && left)
                player.Move(new Vector2(-1, 1));
            else if (down && right)
                player.Move(new Vector2(1, 1));

            // Stop movement
            if (!left && !right && !up && !down)
                player.Move(new Vector2(0, 0));
        }
Пример #2
0
        //#1006 Level 2
        private void DefineLevel02()
        {
            // Add NextLevelCollider
              // This is a invisible rectangle that progresses you to the next level
              // NextLevelColliders.Add(new NextLevelCollider(3180, 114, 200, 200));

              // Add Player
              player = new Player(PlayerTexture, new Vector2(-1629.0f, 388.8719f));

              //{X:-287.4885 Y:719.5315}
              // Set Camera to player position
              // Set Camera to level bounds
              camera = new Camera(new Vector2(1692, 259));
              cameraBoundaryMin = new Vector2(-2656, -1387);
              cameraBoundaryMax = new Vector2(6972, 3486);

              ListFog.Add(new Fog(FogTexture, new Vector2(-400, 4)));
              ListFog.Add(new Fog(FogTexture, new Vector2(-776, 97)));

              // Collision Polygon
              // All this will need to go into it's own class with all the other level stuff
              int NumberOfCollisionBlocks = 7;
              for (int i = 0; i < NumberOfCollisionBlocks; i++)
            currentLevelPolygons.Add(new List<Vector2>());

              //{X:-618.5273 Y:189.3238}
              ListItem.Add(new Item(ItemTexture, new Vector2(-1087, -689), (CollectableItem)FacelessAndItems[FacelessType.Child1], false, 0));
              ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(-1478, 98), FacelessType.Child1));
              ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(144, 400), FacelessType.Gender1));
              ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(2298, 33), FacelessType.Hunger1));
              //  ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(2298, 33), FacelessType.Hunger2));
              //  ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(2298, 33), FacelessType.Health2));

              //  ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(2298, 33), FacelessType.Pregnant));
              //  ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(2298, 33), FacelessType.Pregnant2));
              //{X:-1593.942 Y:110.3426}
              ListItem.Add(new Item(ItemTexture, new Vector2(553, 863), (CollectableItem)FacelessAndItems[FacelessType.Gender1], false, 0));

              ListItem.Add(new Item(ItemTexture, new Vector2(-395, 722), (CollectableItem)FacelessAndItems[FacelessType.Hunger1], false, 0));

              // Makes item permanently visible
              foreach (Item item in ListItem)
              {
            item.Active = true;
            item.color = Color.White;
              }

              // Add Guards
              ListGuard.Add(new Guard(new Vector2(-820, -633), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(-662, -128), "LRP", 180));
              ListGuard.Add(new Guard(new Vector2(390, -586), "UD", 180));
              ListGuard.Add(new Guard(new Vector2(882, -270), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(523, 111), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(1294, 300), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(292, 787), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(913, 1609), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(1769, 1185), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(2449, 924), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(2971, 458), "STOP", 180));

              // COLLISION BLOCK 1
              currentLevelPolygons[0].Add(new Vector2(-714.351f, 963.99f));
              currentLevelPolygons[0].Add(new Vector2(1351.903f, 1994.982f));
              currentLevelPolygons[0].Add(new Vector2(4315.833f, 419.827f));
              currentLevelPolygons[0].Add(new Vector2(4315.833f, 2098.248f));
              currentLevelPolygons[0].Add(new Vector2(-714.351f, 2098.248f));

              // COLLISION BLOCK 2
              currentLevelPolygons[1].Add(new Vector2(4315.833f, -342.246f));
              currentLevelPolygons[1].Add(new Vector2(3080.083f, 323.821f));
              currentLevelPolygons[1].Add(new Vector2(2906.065f, 236.813f));
              currentLevelPolygons[1].Add(new Vector2(2525.027f, 419.827f));
              currentLevelPolygons[1].Add(new Vector2(2867.062f, 581.847f));
              currentLevelPolygons[1].Add(new Vector2(2309.005f, 857.875f));
              currentLevelPolygons[1].Add(new Vector2(2143.988f, 755.865f));
              currentLevelPolygons[1].Add(new Vector2(1633.938f, 1019.892f));
              currentLevelPolygons[1].Add(new Vector2(1405.915f, 917.881f));
              currentLevelPolygons[1].Add(new Vector2(1189.893f, 1019.892f));
              currentLevelPolygons[1].Add(new Vector2(1423.916f, 1142.903f));
              currentLevelPolygons[1].Add(new Vector2(982.872f, 1355.925f));
              currentLevelPolygons[1].Add(new Vector2(388.813f, 1013.891f));
              currentLevelPolygons[1].Add(new Vector2(670.841f, 866.876f));
              currentLevelPolygons[1].Add(new Vector2(1219.896f, 725.862f));
              currentLevelPolygons[1].Add(new Vector2(1876.961f, 371.827f));
              currentLevelPolygons[1].Add(new Vector2(1798.953f, 332.823f));
              currentLevelPolygons[1].Add(new Vector2(2095.983f, 182.808f));
              currentLevelPolygons[1].Add(new Vector2(2185.992f, 236.813f));
              currentLevelPolygons[1].Add(new Vector2(2534.027f, 38.793f));
              currentLevelPolygons[1].Add(new Vector2(512f, -972.308f));
              currentLevelPolygons[1].Add(new Vector2(-334.26f, -516.261f));
              currentLevelPolygons[1].Add(new Vector2(-1024.329f, -861.296f));
              currentLevelPolygons[1].Add(new Vector2(0f, -1387.789f));
              currentLevelPolygons[1].Add(new Vector2(4315.833f, -1387.789f));

              // COLLISION BLOCK 3
              currentLevelPolygons[2].Add(new Vector2(-1327.359f, -711.281f));
              currentLevelPolygons[2].Add(new Vector2(-526.279f, -315.242f));
              currentLevelPolygons[2].Add(new Vector2(-1198.346f, 0f));
              currentLevelPolygons[2].Add(new Vector2(-1399.366f, -87.218f));
              currentLevelPolygons[2].Add(new Vector2(-1741.4f, 83.799f));
              currentLevelPolygons[2].Add(new Vector2(-1552.387f, 173.808f));
              currentLevelPolygons[2].Add(new Vector2(-1888.415f, 335.824f));
              currentLevelPolygons[2].Add(new Vector2(-2656.242f, -54.215f));

              // COLLISION BLOCK 4
              currentLevelPolygons[3].Add(new Vector2(-714.351f, 963.99f));
              currentLevelPolygons[3].Add(new Vector2(-349.26f, 768f));
              currentLevelPolygons[3].Add(new Vector2(-487.274f, 704.859f));
              currentLevelPolygons[3].Add(new Vector2(-142.24f, 542.844f));
              currentLevelPolygons[3].Add(new Vector2(172.792f, 692.009f));
              currentLevelPolygons[3].Add(new Vector2(359f, 596.849f));
              currentLevelPolygons[3].Add(new Vector2(583.833f, 707.86f));
              currentLevelPolygons[3].Add(new Vector2(1048.879f, 452.834f));
              currentLevelPolygons[3].Add(new Vector2(880.862f, 371.826f));
              currentLevelPolygons[3].Add(new Vector2(1354.91f, 107.8f));
              currentLevelPolygons[3].Add(new Vector2(550.829f, -273.238f));
              currentLevelPolygons[3].Add(new Vector2(676.842f, -348.246f));
              currentLevelPolygons[3].Add(new Vector2(469.821f, -444.255f));
              currentLevelPolygons[3].Add(new Vector2(334.808f, -366.248f));
              currentLevelPolygons[3].Add(new Vector2(461.666f, -295.777f));
              currentLevelPolygons[3].Add(new Vector2(286.769f, -205.055f));
              currentLevelPolygons[3].Add(new Vector2(990.098f, 143.805f));
              currentLevelPolygons[3].Add(new Vector2(171.728f, 583.386f));
              currentLevelPolygons[3].Add(new Vector2(-726.139f, 138.193f));
              currentLevelPolygons[3].Add(new Vector2(-1561.343f, 545.04f));

              // COLLISION BLOCK 5
              currentLevelPolygons[4].Add(new Vector2(402.24f, 0f));
              currentLevelPolygons[4].Add(new Vector2(-53.398f, 230.146f));
              currentLevelPolygons[4].Add(new Vector2(-464.943f, 24.374f));
              currentLevelPolygons[4].Add(new Vector2(-9.304f, -202.778f));

              // COLLISION BLOCK 6
              currentLevelPolygons[5].Add(new Vector2(602.667f, -746.604f));
              currentLevelPolygons[5].Add(new Vector2(458.359f, -667.769f));
              currentLevelPolygons[5].Add(new Vector2(602.667f, -603.632f));
              currentLevelPolygons[5].Add(new Vector2(748.312f, -683.803f));

              // COLLISION BLOCK 7
              currentLevelPolygons[6].Add(new Vector2(1242.701f, -412.558f));
              currentLevelPolygons[6].Add(new Vector2(1123.78f, -341.74f));
              currentLevelPolygons[6].Add(new Vector2(1077.015f, -242.862f));
              currentLevelPolygons[6].Add(new Vector2(1342.915f, -121.27f));
              currentLevelPolygons[6].Add(new Vector2(1632.866f, -121.27f));
              currentLevelPolygons[6].Add(new Vector2(1447.137f, -329.714f));

              //COLLISIONBLOCK 8
              /*          currentLevelPolygons[7].Add(new Vector2(-1370f, 220f));

                currentLevelPolygons[7].Add(new Vector2(-1400f, 250f));

                currentLevelPolygons[7].Add(new Vector2(-1370f, 220f));

                currentLevelPolygons[7].Add(new Vector2(-1400f, 250f));*/
        }
Пример #3
0
        private void DefineLevel00()
        {
            // Add NextLevelCollider
              // This is a invisible rectangle that progresses you to the next level
              NextLevelColliders.Add(new NextLevelCollider(3180, 114, 200, 200));

              // Add Player
              player = new Player(PlayerTexture, new Vector2(795, 1506));

              // Set Camera to player position
              // Set Camera to level bounds
              camera = new Camera(new Vector2(795, 1506));
              cameraBoundaryMin = new Vector2(0, 0);
              cameraBoundaryMax = new Vector2(3538, 2048);

              // Add Items
              ListItem.Add(new Item(ItemTexture, new Vector2(1020, 1088), CollectableItem.Antibiotics, false, 0));

              // Add Guards
              ListGuard.Add(new Guard(new Vector2(1463, 966), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(2022, 666), "LR", 146));
              ListGuard.Add(new Guard(new Vector2(1771, 1191), "STOP", 0, 180 + 26.5f));
              ListGuard.Add(new Guard(new Vector2(2572, 546), "STOP", 0, 90));
              ListGuard.Add(new Guard(new Vector2(2975, 552), "UD", 0, 90));

              // Add Faceless
              ListFaceless.Add(new Faceless(FacelessTexture, FacelessSpeechTexture, new Vector2(1451, 1312), FacelessType.Health1));

              // Fog
              ListFog.Add(new Fog(FogTexture, new Vector2(2026, 883)));
              ListFog.Add(new Fog(FogTexture, new Vector2(1569, 1048)));

              // Collision Polygon
              // All this will need to go into it's own class with all the other level stuff
              currentLevelPolygons.Add(new List<Vector2>());
              currentLevelPolygons.Add(new List<Vector2>());
              currentLevelPolygons.Add(new List<Vector2>());

              // LEFT SIDE
              currentLevelPolygons[0].Add(new Vector2(2469.251f, 523.07f));
              currentLevelPolygons[0].Add(new Vector2(2374.146f, 475.519f));
              currentLevelPolygons[0].Add(new Vector2(1427.293f, 962.23f));
              currentLevelPolygons[0].Add(new Vector2(969.95f, 1201.391f));
              currentLevelPolygons[0].Add(new Vector2(872.048f, 1156.636f));
              currentLevelPolygons[0].Add(new Vector2(711.209f, 1236.355f));
              currentLevelPolygons[0].Add(new Vector2(732.188f, 1327.265f));
              currentLevelPolygons[0].Add(new Vector2(799.32f, 1381.811f));
              currentLevelPolygons[0].Add(new Vector2(533f, 1521f));
              currentLevelPolygons[0].Add(new Vector2(841.734f, 1679.982f));
              currentLevelPolygons[0].Add(new Vector2(841.734f, 1743.623f));
              currentLevelPolygons[0].Add(new Vector2(58.708f, 1315.465f));
              currentLevelPolygons[0].Add(new Vector2(2517.727f, 156.35f));
              currentLevelPolygons[0].Add(new Vector2(2857.116f, -8.242f));
              currentLevelPolygons[0].Add(new Vector2(3123.781f, 127.443f));

              // RIGHT SIDE
              currentLevelPolygons[1].Add(new Vector2(865.056f, 1693.698f));
              currentLevelPolygons[1].Add(new Vector2(1333.586f, 1478.313f));
              currentLevelPolygons[1].Add(new Vector2(1353.166f, 1490.9f));
              currentLevelPolygons[1].Add(new Vector2(1396.523f, 1482.509f));
              currentLevelPolygons[1].Add(new Vector2(1487.433f, 1527.265f));
              currentLevelPolygons[1].Add(new Vector2(1848.973f, 1350.829f));
              currentLevelPolygons[1].Add(new Vector2(1968.075f, 1408.238f));
              currentLevelPolygons[1].Add(new Vector2(2620.302f, 1065.726f));
              currentLevelPolygons[1].Add(new Vector2(3364.335f, 644.125f));
              currentLevelPolygons[1].Add(new Vector2(2975.72f, 452.178f));
              currentLevelPolygons[1].Add(new Vector2(3305.99f, 246.473f));
              currentLevelPolygons[1].Add(new Vector2(4050.83f, 578.271f));
              currentLevelPolygons[1].Add(new Vector2(1466.618f, 2030.988f));
              currentLevelPolygons[1].Add(new Vector2(864.883f, 1745.55f));

              // ISLAND
              currentLevelPolygons[2].Add(new Vector2(2261.282f, 695.538f));
              currentLevelPolygons[2].Add(new Vector2(1692.453f, 973.234f));
              currentLevelPolygons[2].Add(new Vector2(1735.75f, 1001.601f));
              currentLevelPolygons[2].Add(new Vector2(1673.044f, 1044.897f));
              currentLevelPolygons[2].Add(new Vector2(1683.495f, 1079.236f));
              currentLevelPolygons[2].Add(new Vector2(1798.455f, 1140.448f));
              currentLevelPolygons[2].Add(new Vector2(1844.737f, 1131.49f));
              currentLevelPolygons[2].Add(new Vector2(1934.316f, 1176.28f));
              currentLevelPolygons[2].Add(new Vector2(2097.052f, 1085.208f));
              currentLevelPolygons[2].Add(new Vector2(2191.109f, 1132.983f));
              currentLevelPolygons[2].Add(new Vector2(2585.259f, 934.415f));
              currentLevelPolygons[2].Add(new Vector2(2497.173f, 892.611f));
              currentLevelPolygons[2].Add(new Vector2(2468.807f, 809.005f));
        }
Пример #4
0
        //#1007 - Level 3
        public void DefineLevel03()
        {
            // Add NextLevelCollider
              // This is a invisible rectangle that progresses you to the next level
              // NextLevelColliders.Add(new NextLevelCollider(3180, 114, 200, 200));

              // Add Player
              player = new Player(PlayerTexture, new Vector2(-3426, 2206));

              // Set Camera to player position
              // Set Camera to level bounds
              camera = new Camera(new Vector2(-3426, 2206));
              cameraBoundaryMin = new Vector2(-3980, -1944);
              cameraBoundaryMax = new Vector2(8984, 4430);

              // Makes item permanently visible
              foreach (Item item in ListItem)
              {
            item.Active = true;
            item.color = Color.White;
              }

              // Collision Polygon
              // All this will need to go into it's own class with all the other level stuff
              int NumberOfCollisionBlocks = 12;
              for (int i = 0; i < NumberOfCollisionBlocks; i++)
            currentLevelPolygons.Add(new List<Vector2>());

              // Add Guards
              ListGuard.Add(new Guard(new Vector2(-1670, 1338), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(-322, 628), "UD", 180));
              ListGuard.Add(new Guard(new Vector2(440, 227), "LR", 180));
              ListGuard.Add(new Guard(new Vector2(190, -614), "UD", 180));
              ListGuard.Add(new Guard(new Vector2(1960, -496), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(2590, 575), "STOP", 180));
              ListGuard.Add(new Guard(new Vector2(3195, -1127), "STOP", 180));

              // COLLISION BLOCK 1
              currentLevelPolygons[0].Add(new Vector2(-1315.725f, 1410.011f));
              currentLevelPolygons[0].Add(new Vector2(-2436.551f, 1970.425f));
              currentLevelPolygons[0].Add(new Vector2(-1991.4f, 2189.025f));
              currentLevelPolygons[0].Add(new Vector2(-862.625f, 1628.612f));

              // COLLISION BLOCK 2
              currentLevelPolygons[1].Add(new Vector2(-1649.588f, 1195.384f));
              currentLevelPolygons[1].Add(new Vector2(-2853.88f, 1799.518f));
              currentLevelPolygons[1].Add(new Vector2(-3370.573f, 1545.146f));
              currentLevelPolygons[1].Add(new Vector2(-2758.491f, 1243.079f));
              currentLevelPolygons[1].Add(new Vector2(-2476.296f, 1382.188f));
              currentLevelPolygons[1].Add(new Vector2(-1876.138f, 1084.097f));

              // COLLISION BLOCK 3
              currentLevelPolygons[2].Add(new Vector2(-1629.715f, 583.301f));
              currentLevelPolygons[2].Add(new Vector2(-961.988f, 917.164f));
              currentLevelPolygons[2].Add(new Vector2(-862.625f, 869.47f));
              currentLevelPolygons[2].Add(new Vector2(-715.565f, 583.301f));
              currentLevelPolygons[2].Add(new Vector2(-91.559f, 297.132f));
              currentLevelPolygons[2].Add(new Vector2(639.761f, 122.251f));
              currentLevelPolygons[2].Add(new Vector2(917.98f, 0f));
              currentLevelPolygons[2].Add(new Vector2(242.304f, -354.696f));

              // COLLISION BLOCK 4
              currentLevelPolygons[3].Add(new Vector2(-703.642f, 1036.401f));
              currentLevelPolygons[3].Add(new Vector2(834.514f, 1302.697f));
              currentLevelPolygons[3].Add(new Vector2(1379.029f, 833.698f));
              currentLevelPolygons[3].Add(new Vector2(1303.513f, 177.896f));
              currentLevelPolygons[3].Add(new Vector2(1152.479f, 102.379f));
              currentLevelPolygons[3].Add(new Vector2(917.98f, 233.54f));
              currentLevelPolygons[3].Add(new Vector2(568.219f, 599.199f));
              currentLevelPolygons[3].Add(new Vector2(39.602f, 857.546f));

              // COLLISION BLOCK 5
              currentLevelPolygons[4].Add(new Vector2(1621.477f, 340.853f));
              currentLevelPolygons[4].Add(new Vector2(1561.858f, 742.283f));
              currentLevelPolygons[4].Add(new Vector2(2007.01f, 533.619f));

              // COLLISION BLOCK 6
              currentLevelPolygons[5].Add(new Vector2(2249.458f, -434.187f));
              currentLevelPolygons[5].Add(new Vector2(1514.163f, -72.502f));
              currentLevelPolygons[5].Add(new Vector2(2364.72f, 356.751f));
              currentLevelPolygons[5].Add(new Vector2(3080.142f, -291.103f));

              // COLLISION BLOCK 7
              currentLevelPolygons[6].Add(new Vector2(2634.99f, -875.364f));
              currentLevelPolygons[6].Add(new Vector2(1279.664f, -191.739f));
              currentLevelPolygons[6].Add(new Vector2(647.709f, -497.78f));
              currentLevelPolygons[6].Add(new Vector2(1939.441f, -923.059f));

              // COLLISION BLOCK 8
              currentLevelPolygons[7].Add(new Vector2(3469.648f, -1046.271f));
              currentLevelPolygons[7].Add(new Vector2(2718.456f, -664.713f));
              currentLevelPolygons[7].Add(new Vector2(3382.208f, -462.01f));
              currentLevelPolygons[7].Add(new Vector2(3942.621f, -776f));

              // COLLISION BLOCK 9
              currentLevelPolygons[8].Add(new Vector2(3199.378f, -1157.559f));
              currentLevelPolygons[8].Add(new Vector2(2913.21f, -1010.5f));
              currentLevelPolygons[8].Add(new Vector2(2265.355f, -1046.271f));
              currentLevelPolygons[8].Add(new Vector2(2571.397f, -1312.566f));

              // COLLISION BLOCK 10
              currentLevelPolygons[9].Add(new Vector2(4492.072f, -1353.479f));
              currentLevelPolygons[9].Add(new Vector2(4332.129f, -1837.208f));
              currentLevelPolygons[9].Add(new Vector2(3672.351f, -1737.845f));
              currentLevelPolygons[9].Add(new Vector2(3596.834f, -1225.126f));
              currentLevelPolygons[9].Add(new Vector2(3887.112f, -1263.659f));
              currentLevelPolygons[9].Add(new Vector2(4264.563f, -640.865f));
              currentLevelPolygons[9].Add(new Vector2(3735.945f, -434.187f));
              currentLevelPolygons[9].Add(new Vector2(4097.631f, -171.867f));
              currentLevelPolygons[9].Add(new Vector2(4677.917f, -235.46f));
              currentLevelPolygons[9].Add(new Vector2(4983.958f, 34.811f));
              currentLevelPolygons[9].Add(new Vector2(4558.682f, 270.264f));
              currentLevelPolygons[9].Add(new Vector2(4081.734f, 38.786f));
              currentLevelPolygons[9].Add(new Vector2(3648.507f, -38.718f));
              currentLevelPolygons[9].Add(new Vector2(3036.425f, 682.665f));
              currentLevelPolygons[9].Add(new Vector2(4240.719f, 1294.747f));
              currentLevelPolygons[9].Add(new Vector2(4089.685f, 1521.298f));
              currentLevelPolygons[9].Add(new Vector2(2718.461f, 893.317f));
              currentLevelPolygons[9].Add(new Vector2(1927.522f, 1338.469f));
              currentLevelPolygons[9].Add(new Vector2(1760.591f, 1521.298f));
              currentLevelPolygons[9].Add(new Vector2(814.645f, 1680.281f));
              currentLevelPolygons[9].Add(new Vector2(337.694f, 1469.628f));
              currentLevelPolygons[9].Add(new Vector2(-886.47f, 1123.842f));
              currentLevelPolygons[9].Add(new Vector2(-997.758f, 1179.485f));
              currentLevelPolygons[9].Add(new Vector2(-465.166f, 1632.586f));
              currentLevelPolygons[9].Add(new Vector2(-910.317f, 2137.355f));
              currentLevelPolygons[9].Add(new Vector2(-1820.492f, 2351.982f));
              currentLevelPolygons[9].Add(new Vector2(-3048.632f, 2212.873f));
              currentLevelPolygons[9].Add(new Vector2(-2897.599f, 2395.703f));
              currentLevelPolygons[9].Add(new Vector2(-3048.632f, 2484.974f));
              currentLevelPolygons[9].Add(new Vector2(5003.85f, 2484.974f));
              currentLevelPolygons[9].Add(new Vector2(5003.85f, -1400.002f));

              // COLLISION BLOCK 11
              currentLevelPolygons[10].Add(new Vector2(3199.378f, -1423.849f));
              currentLevelPolygons[10].Add(new Vector2(2515.757f, -1650.399f));
              currentLevelPolygons[10].Add(new Vector2(1561.858f, -1070.112f));
              currentLevelPolygons[10].Add(new Vector2(1319.413f, -1010.5f));
              currentLevelPolygons[10].Add(new Vector2(1100.813f, -1213.197f));
              currentLevelPolygons[10].Add(new Vector2(544.373f, -1086.011f));
              currentLevelPolygons[10].Add(new Vector2(810.669f, -903.181f));
              currentLevelPolygons[10].Add(new Vector2(146.917f, -748.173f));
              currentLevelPolygons[10].Add(new Vector2(-2039.093f, -1944.446f));
              currentLevelPolygons[10].Add(new Vector2(3247.076f, -1944.446f));

              // COLLISION BLOCK 12
              currentLevelPolygons[11].Add(new Vector2(-55.785f, -497.775f));
              currentLevelPolygons[11].Add(new Vector2(-2603.48f, -1944.446f));
              currentLevelPolygons[11].Add(new Vector2(-3979.846f, -1944.446f));
              currentLevelPolygons[11].Add(new Vector2(-3979.846f, 1934.657f));
              currentLevelPolygons[11].Add(new Vector2(-3668.664f, 1918.759f));
              currentLevelPolygons[11].Add(new Vector2(-3652.765f, 1366.295f));
              currentLevelPolygons[11].Add(new Vector2(-3136.072f, 968.839f));
              currentLevelPolygons[11].Add(new Vector2(-2718.743f, 960.89f));
              currentLevelPolygons[11].Add(new Vector2(-2051.017f, 845.627f));
              currentLevelPolygons[11].Add(new Vector2(-1256.104f, 1084.097f));
              currentLevelPolygons[11].Add(new Vector2(-1164.689f, 1028.457f));
              currentLevelPolygons[11].Add(new Vector2(-2138.457f, 575.356f));
              currentLevelPolygons[11].Add(new Vector2(-2305.389f, 658.822f));
              currentLevelPolygons[11].Add(new Vector2(-2762.463f, 440.222f));
              currentLevelPolygons[11].Add(new Vector2(-2158.33f, 142.129f));
              currentLevelPolygons[11].Add(new Vector2(-1729.077f, 360.73f));
        }
Пример #5
0
        public void Update(GameTime gameTime, Player player)
        {
            PlayerHitPosition = player.HitPosition;

              // Getting close to cone/circle
              inCone = polyCollisionCheck(AlertCone, PlayerHitPosition);

              // Return false if player is sneaking
              inCircle = Vector2.Distance(PlayerHitPosition, AlertCone[0]) < 250 && player.playerState != PlayerState.Sneaking;

              // Actions
              if (inCone)
            player.ResetPlayer();

              if (inCircle && MovementType != "STOP")
              {
            MovementTypeLast = MovementType;
            MovementType = "STOP";
              }

              if (!inCircle && MovementType == "STOP")
              {
            InitializeMovement(MovementTypeLast);
            MovementType = MovementTypeLast;
              }

              if (inCircle && MovementType == "STOP")
              {
            // Rotates when angle is outside a certain threshold
            Vector2 a = AlertCone[0];
            Vector2 b = player.HitPosition;

            float PlayerEnemyAngle;
            PlayerEnemyAngle = (float)Math.Atan2(b.Y - a.Y, b.X - a.X);
            PlayerEnemyAngle = (float)(PlayerEnemyAngle * (180 / Math.PI));

            if (PlayerEnemyAngle < 0)
              PlayerEnemyAngle += 360;

            if (PlayerEnemyAngle - CurrentAngle > 10)
              CurrentAngle++;
            else
              CurrentAngle--;

            if (CurrentAngle > 360)
              CurrentAngle = 0;
              }

              Movement();

              Position.X += Velocity.X;
              Position.Y += Velocity.Y;

              CollisionBox = new Rectangle(
              (int)(Math.Round(Position.X) - FRAME_WIDTH / 2),
              (int)(Math.Round(Position.Y) - FRAME_HEIGHT / 2),
              FRAME_WIDTH,
              FRAME_HEIGHT);

              // Ring Collision Box Update
              RingCollision = new Rectangle(
              (int)(Math.Round(Position.X - RingSize / 2)),
              (int)(Math.Round(Position.Y - RingSize / 2)),
              RingSize,
              RingSize);

              float angleLock = 45;

              float ringAngle1 = (CurrentAngle - angleLock / 2) * (float)(Math.PI / 180);
              float ringAngle2 = (CurrentAngle + angleLock / 2) * (float)(Math.PI / 180);

              AlertCone[0] = new Vector2(
              (float)(Math.Round(Position.X)),
              (float)(Math.Round(Position.Y)));

              AlertCone[1] = new Vector2(
              AlertCone[0].X + (float)(Math.Cos(ringAngle1) * RingSize / 2),
              AlertCone[0].Y + (float)(Math.Sin(ringAngle1) * RingSize / 2));

              AlertCone[2] = new Vector2(
              AlertCone[0].X + (float)(Math.Cos(ringAngle2) * RingSize / 2),
              AlertCone[0].Y + (float)(Math.Sin(ringAngle2) * RingSize / 2));

              // Update Rectangles
              DestRect.X = CollisionBox.X;
              DestRect.Y = CollisionBox.Y - FRAME_HEIGHT / 2 + 35;

              // Update Animation
              if (gameTime.TotalGameTime - AnimationLast > AnimationRate)
              {
            AnimationLast = gameTime.TotalGameTime;

            if (++Frame > 1)
              Frame = 0;

            SourceRect.X = FRAME_WIDTH * Frame;
              }
        }
Пример #6
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D kid = Content.Load<Texture2D>("Textures/kidWhite");
            player = new Player(kid, new Vector2(782, 3856));

            // Blank tile for testing
            blankTexture = Content.Load<Texture2D>("Textures/blank");

            // Guard
            GuardObjects.Add(new Guard(new Vector2(600, 3600), "HalfCircleDown", kid));

            // Level Image/s
            LevelTutorial = Content.Load<Texture2D>("Textures/LevelTutorial");

            // Collision Polygon
            // All this will need to go into it's own class with all the other level stuff
            // LEFT SIDE
            CollisionPoly0.Add(new Vector2(0, 0));
            CollisionPoly0.Add(new Vector2(672, 1));
            CollisionPoly0.Add(new Vector2(672, 198));
            CollisionPoly0.Add(new Vector2(604, 198));
            CollisionPoly0.Add(new Vector2(604, 280));
            CollisionPoly0.Add(new Vector2(358, 280));
            CollisionPoly0.Add(new Vector2(358, 587));
            CollisionPoly0.Add(new Vector2(743, 587));
            CollisionPoly0.Add(new Vector2(743, 668));
            CollisionPoly0.Add(new Vector2(590, 668));
            CollisionPoly0.Add(new Vector2(590, 1125));
            CollisionPoly0.Add(new Vector2(477, 1125));
            CollisionPoly0.Add(new Vector2(477, 2313));
            CollisionPoly0.Add(new Vector2(533, 2313));
            CollisionPoly0.Add(new Vector2(533, 2506));
            CollisionPoly0.Add(new Vector2(662, 2506));
            CollisionPoly0.Add(new Vector2(662, 2891));
            CollisionPoly0.Add(new Vector2(426, 2891));
            CollisionPoly0.Add(new Vector2(426, 3101));
            CollisionPoly0.Add(new Vector2(662, 3101));
            CollisionPoly0.Add(new Vector2(662, 4000));
            CollisionPoly0.Add(new Vector2(0, 4000));

            // RIGHT SIDE
            CollisionPoly1.Add(new Vector2(1113, 0));
            CollisionPoly1.Add(new Vector2(2048, 0));
            CollisionPoly1.Add(new Vector2(2048, 4000));
            CollisionPoly1.Add(new Vector2(1178, 4000));
            CollisionPoly1.Add(new Vector2(1178, 3235));
            CollisionPoly1.Add(new Vector2(1302, 3235));
            CollisionPoly1.Add(new Vector2(1302, 2964));
            CollisionPoly1.Add(new Vector2(1196, 2964));
            CollisionPoly1.Add(new Vector2(1196, 2683));
            CollisionPoly1.Add(new Vector2(1249, 2683));
            CollisionPoly1.Add(new Vector2(1249, 2594));
            CollisionPoly1.Add(new Vector2(1249, 2594));
            CollisionPoly1.Add(new Vector2(1394, 2422));
            CollisionPoly1.Add(new Vector2(1444, 2422));
            CollisionPoly1.Add(new Vector2(1444, 2318));
            CollisionPoly1.Add(new Vector2(1489, 2318));
            CollisionPoly1.Add(new Vector2(1489, 1574));
            CollisionPoly1.Add(new Vector2(1400, 1574));
            CollisionPoly1.Add(new Vector2(1400, 1407));
            CollisionPoly1.Add(new Vector2(1288, 1407));
            CollisionPoly1.Add(new Vector2(1288, 1020));
            CollisionPoly1.Add(new Vector2(1139, 1020));
            CollisionPoly1.Add(new Vector2(1139, 662));
            CollisionPoly1.Add(new Vector2(876, 662));
            CollisionPoly1.Add(new Vector2(876, 578));
            CollisionPoly1.Add(new Vector2(1452, 578));
            CollisionPoly1.Add(new Vector2(1452, 325));
            CollisionPoly1.Add(new Vector2(1339, 325));
            CollisionPoly1.Add(new Vector2(1339, 238));
            CollisionPoly1.Add(new Vector2(1167, 238));
            CollisionPoly1.Add(new Vector2(1167, 138));
            CollisionPoly1.Add(new Vector2(113, 138));

            // MIDDLE ISLAND
            CollisionPoly2.Add(new Vector2(704, 1542));
            CollisionPoly2.Add(new Vector2(1113, 1542));
            CollisionPoly2.Add(new Vector2(1113, 1632));
            CollisionPoly2.Add(new Vector2(1307, 1632));
            CollisionPoly2.Add(new Vector2(1307, 2190));
            CollisionPoly2.Add(new Vector2(1155, 2190));
            CollisionPoly2.Add(new Vector2(1155, 2426));
            CollisionPoly2.Add(new Vector2(1017, 2426));
            CollisionPoly2.Add(new Vector2(1017, 2555));
            CollisionPoly2.Add(new Vector2(831, 2555));
            CollisionPoly2.Add(new Vector2(832, 2319));
            CollisionPoly2.Add(new Vector2(644, 2319));
            CollisionPoly2.Add(new Vector2(644, 2008));
            CollisionPoly2.Add(new Vector2(846, 2008));
            CollisionPoly2.Add(new Vector2(846, 1846));
            CollisionPoly2.Add(new Vector2(644, 1846));
            CollisionPoly2.Add(new Vector2(644, 1828));
            CollisionPoly2.Add(new Vector2(704, 1828));

            ListofPolygons.Add(CollisionPoly0);
            ListofPolygons.Add(CollisionPoly1);
            ListofPolygons.Add(CollisionPoly2);
        }