public override void LoadContent() { base.LoadContent(); World.Gravity = Vector2.Zero; _border = new Border(World, Lines, Framework.GraphicsDevice); // 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; Vector2 startPosition = new Vector2(-20f, -11f); Vector2 endPosition = new Vector2(20, -11f); _circles = new Objects(World, startPosition, endPosition, 15, 0.6f, ObjectType.Circle); // Collide with itself only _circles.CollisionCategories = Category.Cat1; _circles.CollidesWith = Category.Cat1; startPosition = new Vector2(-20, 11f); endPosition = new Vector2(20, 11f); _rectangles = new Objects(World, startPosition, endPosition, 15, 1.2f, ObjectType.Rectangle); // Collides with itself only _rectangles.CollisionCategories = Category.Cat2; _rectangles.CollidesWith = Category.Cat2; startPosition = new Vector2(-20, 7); endPosition = new Vector2(-20, -7); _gears = new Objects(World, startPosition, endPosition, 5, 0.6f, ObjectType.Gear); // Collides with stars _gears.CollisionCategories = Category.Cat3; _gears.CollidesWith = Category.Cat3 | Category.Cat4; startPosition = new Vector2(20, 7); endPosition = new Vector2(20, -7); _stars = new Objects(World, startPosition, endPosition, 5, 0.6f, ObjectType.Star); // Collides with gears _stars.CollisionCategories = Category.Cat4; _stars.CollidesWith = Category.Cat3 | Category.Cat4; SetUserAgent(_agent.Body, 1000f, 400f); }
public override void LoadContent() { base.LoadContent(); World.Gravity = Vector2.Zero; _border = new Border(World, ScreenManager, Camera); var startXPoint = -10f; var startYPoint = -3f; var diameter = 1.2f; var ballCount = 5; var startPosition = new Vector2(startXPoint, startYPoint); var endPosition = new Vector2(startXPoint, startYPoint + ((diameter-0.2f) * ballCount)); _circles = new Objects(World, ScreenManager, startPosition, endPosition, ballCount, diameter/2f, ObjectType.Circle) { //Collide with itself only CollisionCategories = Category.Cat1, CollidesWith = Category.Cat1 }; startXPoint+=1.1f; startYPoint += 0.6f; ballCount=4; startPosition = new Vector2(startXPoint, startYPoint); endPosition = new Vector2(startXPoint, startYPoint + ((diameter - 0.2f) * ballCount)); _circles1 = new Objects(World, ScreenManager, startPosition, endPosition, ballCount, diameter / 2f, ObjectType.Circle) { //Collide with itself only CollisionCategories = Category.Cat1, CollidesWith = Category.Cat1 }; startXPoint += 1.1f; startYPoint += 0.6f; ballCount = 3; startPosition = new Vector2(startXPoint, startYPoint); endPosition = new Vector2(startXPoint, startYPoint + ((diameter -0.3f) * ballCount)); _circles2 = new Objects(World, ScreenManager, startPosition, endPosition, ballCount, diameter / 2f, ObjectType.Circle) { //Collide with itself only CollisionCategories = Category.Cat1, CollidesWith = Category.Cat1 }; startXPoint += 1.1f; startYPoint += 0.6f; ballCount = 2; startPosition = new Vector2(startXPoint, startYPoint); endPosition = new Vector2(startXPoint, startYPoint + ((diameter - 0.5f) * ballCount)); _circles3 = new Objects(World, ScreenManager, startPosition, endPosition, ballCount, diameter / 2f, ObjectType.Circle) { //Collide with itself only CollisionCategories = Category.Cat1, CollidesWith = Category.Cat1 }; startXPoint += 1f; startYPoint += 0.7f; ballCount = 2; startPosition = new Vector2(startXPoint, startYPoint); endPosition = new Vector2(startXPoint *-1f, startYPoint); _circles4 = new Objects(World, ScreenManager, startPosition, endPosition, ballCount, diameter / 2f, ObjectType.Circle) { //Collide with itself only CollisionCategories = Category.Cat1, CollidesWith = Category.Cat1 }; }