Ejemplo n.º 1
0
        private void LoadCircles()
        {
            _redCircles = new Circles[10];
            _blueCircles = new Circles[10];
            _blackCircles = new Circles[10];
            _greenCircles = new Circles[10];

            Vector2 startPosition = new Vector2(50, 50);
            Vector2 endPosition = new Vector2(ScreenManager.ScreenWidth - 50, 50);

            #if XBOX
            const int balls = 20;
            #else
            const int balls = 40;
            #endif

            const float ySpacing = 12;
            for (int i = 0; i < _redCircles.Length; i++)
            {
                _redCircles[i] = new Circles(startPosition, endPosition, balls, 5, new Color(200, 0, 0, 175),
                                             Color.Black);
                _redCircles[i].CollisionCategories = (CollisionCategory.Cat1);
                _redCircles[i].CollidesWith = (CollisionCategory.Cat5);
                _redCircles[i].Load(ScreenManager.GraphicsDevice, PhysicsSimulator);
                startPosition.Y += ySpacing;
                endPosition.Y += ySpacing;
            }

            startPosition.Y += 2 * ySpacing;
            endPosition.Y += 2 * ySpacing;

            for (int i = 0; i < _blueCircles.Length; i++)
            {
                _blueCircles[i] = new Circles(startPosition, endPosition, balls, 5, new Color(0, 0, 200, 175),
                                              Color.Black);
                _blueCircles[i].CollisionCategories = (CollisionCategory.Cat3);
                _blueCircles[i].CollidesWith = (CollisionCategory.Cat5);
                _blueCircles[i].Load(ScreenManager.GraphicsDevice, PhysicsSimulator);
                startPosition.Y += ySpacing;
                endPosition.Y += ySpacing;
            }

            startPosition.Y += 12 * ySpacing;
            endPosition.Y += 12 * ySpacing;

            for (int i = 0; i < _greenCircles.Length; i++)
            {
                _greenCircles[i] = new Circles(startPosition, endPosition, balls, 5, new Color(0, 200, 0, 175),
                                               Color.Black);
                _greenCircles[i].CollisionCategories = (CollisionCategory.Cat2);
                _greenCircles[i].CollidesWith = (CollisionCategory.Cat5);
                _greenCircles[i].Load(ScreenManager.GraphicsDevice, PhysicsSimulator);
                startPosition.Y += ySpacing;
                endPosition.Y += ySpacing;
            }

            startPosition.Y += 2 * ySpacing;
            endPosition.Y += 2 * ySpacing;

            for (int i = 0; i < _blackCircles.Length; i++)
            {
                _blackCircles[i] = new Circles(startPosition, endPosition, balls, 5, new Color(0, 0, 0, 175),
                                               Color.Black);
                _blackCircles[i].CollisionCategories = (CollisionCategory.Cat4);
                _blackCircles[i].CollidesWith = (CollisionCategory.Cat5);
                _blackCircles[i].Load(ScreenManager.GraphicsDevice, PhysicsSimulator);
                startPosition.Y += ySpacing;
                endPosition.Y += ySpacing;
            }
        }
Ejemplo n.º 2
0
        private void LoadCircles()
        {
            //Cat1=Red, Cat2=Green, Cat3=Blue, Cat4=Black, Cat5=Agent
            Vector2 startPosition = new Vector2(100, 100);
            Vector2 endPosition = new Vector2(100, ScreenManager.ScreenHeight - 100);
            _redCircles1 = new Circles(startPosition, endPosition, 15, 15, new Color(200, 0, 0, 175), Color.Black);
            _redCircles1.CollisionCategories = (CollisionCategory.Cat1);
            _redCircles1.CollidesWith = (CollisionCategory.Cat1 | CollisionCategory.Cat4 |
                                         CollisionCategory.Cat5);
            _redCircles1.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(200, 200);
            endPosition = new Vector2(200, ScreenManager.ScreenHeight - 200);
            _redCircles2 = new Circles(startPosition, endPosition, 15, 12, new Color(200, 0, 0, 175), Color.Black);
            _redCircles2.CollisionCategories = (CollisionCategory.Cat1);
            _redCircles2.CollidesWith = (CollisionCategory.Cat1 | CollisionCategory.Cat4 |
                                         CollisionCategory.Cat5);
            _redCircles2.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(300, 300);
            endPosition = new Vector2(300, ScreenManager.ScreenHeight - 300);
            _redCircles3 = new Circles(startPosition, endPosition, 10, 9, new Color(200, 0, 0, 175), Color.Black);
            _redCircles3.CollisionCategories = (CollisionCategory.Cat1);
            _redCircles3.CollidesWith = (CollisionCategory.Cat1 | CollisionCategory.Cat4 |
                                         CollisionCategory.Cat5);
            _redCircles3.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(200, 100);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 200, 100);
            _greenCircles1 = new Circles(startPosition, endPosition, 15, 15, new Color(0, 200, 0, 175), Color.Black);
            _greenCircles1.CollisionCategories = (CollisionCategory.Cat2);
            _greenCircles1.CollidesWith = (CollisionCategory.Cat2 | CollisionCategory.Cat4 |
                                           CollisionCategory.Cat5);
            _greenCircles1.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(300, 200);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 300, 200);
            _greenCircles2 = new Circles(startPosition, endPosition, 15, 12, new Color(0, 200, 0, 175), Color.Black);
            _greenCircles2.CollisionCategories = (CollisionCategory.Cat2);
            _greenCircles2.CollidesWith = (CollisionCategory.Cat2 | CollisionCategory.Cat4 |
                                           CollisionCategory.Cat5);
            _greenCircles2.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(400, 300);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 400, 300);
            _greenCircles3 = new Circles(startPosition, endPosition, 10, 9, new Color(0, 200, 0, 175), Color.Black);
            _greenCircles3.CollisionCategories = (CollisionCategory.Cat2);
            _greenCircles3.CollidesWith = (CollisionCategory.Cat2 | CollisionCategory.Cat4 |
                                           CollisionCategory.Cat5);
            _greenCircles3.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(ScreenManager.ScreenWidth - 100, 100);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 100, ScreenManager.ScreenHeight - 100);
            _blueCircles1 = new Circles(startPosition, endPosition, 15, 15, new Color(0, 0, 200, 175), Color.Black);
            _blueCircles1.CollisionCategories = (CollisionCategory.Cat3);
            _blueCircles1.CollidesWith = (CollisionCategory.Cat3 | CollisionCategory.Cat4 |
                                          CollisionCategory.Cat5);
            _blueCircles1.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(ScreenManager.ScreenWidth - 200, 200);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 200, ScreenManager.ScreenHeight - 200);
            _blueCircles2 = new Circles(startPosition, endPosition, 15, 12, new Color(0, 0, 200, 175), Color.Black);
            _blueCircles2.CollisionCategories = (CollisionCategory.Cat3);
            _blueCircles2.CollidesWith = (CollisionCategory.Cat3 | CollisionCategory.Cat4 |
                                          CollisionCategory.Cat5);
            _blueCircles2.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(ScreenManager.ScreenWidth - 300, 300);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 300, ScreenManager.ScreenHeight - 300);
            _blueCircles3 = new Circles(startPosition, endPosition, 10, 9, new Color(0, 0, 200, 175), Color.Black);
            _blueCircles3.CollisionCategories = (CollisionCategory.Cat3);
            _blueCircles3.CollidesWith = (CollisionCategory.Cat3 | CollisionCategory.Cat4 |
                                          CollisionCategory.Cat5);
            _blueCircles3.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(200, ScreenManager.ScreenHeight - 100);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 200, ScreenManager.ScreenHeight - 100);
            _blackCircles1 = new Circles(startPosition, endPosition, 15, 15, new Color(0, 0, 0, 200), Color.Black);
            _blackCircles1.CollisionCategories = CollisionCategory.Cat4;
            _blackCircles1.CollidesWith = CollisionCategory.All & ~CollisionCategory.Cat5;
            //Collide with all but Cat5
            _blackCircles1.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(300, ScreenManager.ScreenHeight - 200);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 300, ScreenManager.ScreenHeight - 200);
            _blackCircles2 = new Circles(startPosition, endPosition, 15, 12, new Color(0, 0, 0, 200), Color.Black);
            _blackCircles2.CollisionCategories = CollisionCategory.Cat4;
            _blackCircles2.CollidesWith = CollisionCategory.All & ~CollisionCategory.Cat5;
            //Collide with all but Cat5
            _blackCircles2.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            startPosition = new Vector2(400, ScreenManager.ScreenHeight - 300);
            endPosition = new Vector2(ScreenManager.ScreenWidth - 400, ScreenManager.ScreenHeight - 300);
            _blackCircles3 = new Circles(startPosition, endPosition, 10, 9, new Color(0, 0, 0, 200), Color.Black);
            _blackCircles3.CollisionCategories = CollisionCategory.Cat4;
            _blackCircles3.CollidesWith = CollisionCategory.All & ~CollisionCategory.Cat5;
            //Collide with all but Cat5
            _blackCircles3.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);
        }