예제 #1
0
        public override void InitialiseObstacles()
        {
            Ostacles = new List <Ostacle>();

            //Top boundary
            for (int X = 0; X < RightBoundary; X += Ostacle.Width)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(X, TopBoundary), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Right boundary
            for (int Y = 0; Y < BottomBoundary; Y += Ostacle.Height)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(RightBoundary, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Bottom Boundary
            for (int x = (int)RightBoundary; x > LeftBoundary; x -= Ostacle.Width)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(x, BottomBoundary), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Left Boundary
            for (int Y = (int)BottomBoundary; Y > TopBoundary; Y -= Ostacle.Height)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(LeftBoundary, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Obstacle 1
            int xOffset = 8;
            int yOffset = 4;

            for (float X = RightBoundary / xOffset; X <= (RightBoundary / xOffset) + (9 * Ostacle.Width); X += Ostacle.Width)
            {
                for (float Y = TopBoundary + (BottomBoundary / yOffset); Y <= (3 * BottomBoundary) / 4; Y += Ostacle.Height)
                {
                    if (!((X >= RightBoundary / xOffset + (3 * Ostacle.Width)) && Y >= (TopBoundary + (BottomBoundary / yOffset) + (3 * Ostacle.Height)) &&
                          (Y <= (TopBoundary + (BottomBoundary / yOffset) + (BottomBoundary / 2) - (3 * Ostacle.Height)))))
                    {
                        Ostacle ostacle_1 = new Ostacle();
                        ostacle_1.Initialise(graphics, BoundingDot, new Vector2(X, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, false);
                        Ostacles.Add(ostacle_1);
                    }
                }
            }
            ////Obstacle 2
            for (float Y = TopBoundary + (BottomBoundary / 4); Y < (3 * BottomBoundary) / 4; Y += Ostacle.Height)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2((3 * RightBoundary) / 4, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, false);
                Ostacles.Add(ostacle_1);
            }
        }
예제 #2
0
        public override void InitialiseObstacles()
        {
            Ostacles = new List <Ostacle>();

            //Top boundary
            for (int X = 0; X < RightBoundary; X += Ostacle.Width)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(X, TopBoundary), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Right boundary
            for (int Y = 0; Y < BottomBoundary; Y += Ostacle.Height)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(RightBoundary, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Bottom Boundary
            for (int x = (int)RightBoundary; x > LeftBoundary; x -= Ostacle.Width)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(x, BottomBoundary), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Left Boundary
            for (int Y = (int)BottomBoundary; Y > TopBoundary; Y -= Ostacle.Height)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(LeftBoundary, Y), Ostacle, OstacleDestroyed1, OstacleDestroyed2, true);
                Ostacles.Add(ostacle_1);
            }
            //Obstacle 1
            //for (float X = RightBoundary / 4; X < (RightBoundary / 4) * 3; X += Ostacle.Width)
            //{
            //    Ostacle ostacle_1 = new Ostacle();
            //    Ostacle ostacle_2 = new Ostacle();
            //    ostacle_1.Initialise(graphics, BoundingDot, new Vector2(X, BottomBoundary / 2), Ostacle, OstacleDestroyed1, OstacleDestroyed2, false);
            //    ostacle_2.Initialise(graphics, BoundingDot, new Vector2(X, BottomBoundary / 2), Ostacle, OstacleDestroyed1, OstacleDestroyed2, false);
            //    Ostacles.Add(ostacle_1);
            //    Ostacles.Add(ostacle_2);
            //}
            for (float X = RightBoundary / 4; X < (RightBoundary / 4) * 3; X += Ostacle.Width)
            {
                Ostacle ostacle_1 = new Ostacle();
                ostacle_1.Initialise(graphics, BoundingDot, new Vector2(X, BottomBoundary / 2), Ostacle, OstacleDestroyed1, OstacleDestroyed2, false);
                Ostacles.Add(ostacle_1);
            }
        }