예제 #1
0
        public override void LoadContent()
        {
            World = new World(new Vector2(0, -20));
            base.LoadContent();

            _agent = new Agent(World, new Vector2(5, 10));

            LoadObstacles();
        }
예제 #2
0
        public override void LoadContent()
        {
            World = new World(new Vector2(0, -20));
            base.LoadContent();

            _agent = new Agent(World, new Vector2(0, -10));
            _spiders = new Spider[8];

            for (int i = 0; i < _spiders.Length; i++)
            {
                _spiders[i] = new Spider(World, new Vector2(0, ((i + 1)*3) - 7));
            }
        }
예제 #3
0
        public override void LoadContent()
        {
            World = new World(new Vector2(0, -20));
            base.LoadContent();

            _agent = new Agent(World, new Vector2(5, 10));

            Vertices box = PolygonTools.CreateRectangle(0.75f, 0.75f);
            PolygonShape shape = new PolygonShape(box, 1);

            Vector2 x = new Vector2(-14.0f, -23.0f);
            Vector2 deltaX = new Vector2(1.0f, 1.50f);
            Vector2 deltaY = new Vector2(2, 0.0f);

            DebugMaterial matBox = new DebugMaterial(MaterialType.Blank)
                                       {
                                           Color = Color.WhiteSmoke
                                       };

            for (int i = 0; i < PyramidBaseBodyCount; ++i)
            {
                Vector2 y = x;

                for (int j = i; j < PyramidBaseBodyCount; ++j)
                {
                    Body body = BodyFactory.CreateBody(World);
                    body.BodyType = BodyType.Dynamic;
                    body.Position = y;
                    body.CreateFixture(shape, matBox);

                    y += deltaY;
                }

                x += deltaX;
            }
        }
예제 #4
0
        public override void LoadContent()
        {
            World = new World(Vector2.Zero);
            base.LoadContent();

            //Cat1=Circles, Cat2=Rectangles, Cat3=Gears, Cat4=Stars
            _agent = new Agent(World, Vector2.Zero);

            //Collide with all but stars
            _agent.CollisionCategories = Category.All & ~Category.Cat4;
            _agent.CollidesWith = Category.All & ~Category.Cat4;

            DebugMaterial matCircle = new DebugMaterial(MaterialType.Dots)
                                          {
                                              Color = Color.DarkRed,
                                              Scale = 8f
                                          };
            DebugMaterial matSquare = new DebugMaterial(MaterialType.Squares)
                                          {
                                              Color = Color.SeaGreen,
                                              Scale = 9f
                                          };
            DebugMaterial matGear = new DebugMaterial(MaterialType.Dots)
                                        {
                                            Color = Color.SkyBlue,
                                            Scale = 8f
                                        };
            DebugMaterial matStar = new DebugMaterial(MaterialType.Dots)
                                        {
                                            Color = Color.Gold,
                                            Scale = 8f
                                        };

            Vector2 startPosition = new Vector2(-20, 16);
            Vector2 endPosition = new Vector2(20, 16);
            _circles = new Objects(World, startPosition, endPosition, 15, 1, ObjectType.Circle, matCircle);

            //Collide with itself only
            _circles.CollisionCategories = Category.Cat1;
            _circles.CollidesWith = Category.Cat1;

            startPosition = new Vector2(-20, -16);
            endPosition = new Vector2(20, -16);
            _rectangles = new Objects(World, startPosition, endPosition, 15, 2, ObjectType.Rectangle, matSquare);

            //Collides with itself only
            _rectangles.CollisionCategories = Category.Cat2;
            _rectangles.CollidesWith = Category.Cat2;

            startPosition = new Vector2(-20, -10);
            endPosition = new Vector2(-20, 10);
            _gears = new Objects(World, startPosition, endPosition, 5, 1, ObjectType.Gear, matGear);

            //Collides with stars
            _gears.CollisionCategories = Category.Cat3;
            _gears.CollidesWith = Category.Cat3 | Category.Cat4;

            startPosition = new Vector2(20, -10);
            endPosition = new Vector2(20, 10);
            _stars = new Objects(World, startPosition, endPosition, 5, 1, ObjectType.Star, matStar);

            //Collides with gears
            _stars.CollisionCategories = Category.Cat4;
            _stars.CollidesWith = Category.Cat3 | Category.Cat4;
        }