diff --git a/examples/airFriction.js b/examples/airFriction.js index 0c74a0e..ffb3225 100644 --- a/examples/airFriction.js +++ b/examples/airFriction.js @@ -6,7 +6,7 @@ Example.airFriction = function() { Runner = Matter.Runner, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -31,7 +31,7 @@ Example.airFriction = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // falling blocks Bodies.rectangle(200, 100, 60, 60, { frictionAir: 0.001 }), Bodies.rectangle(400, 100, 60, 60, { frictionAir: 0.05 }), @@ -56,7 +56,7 @@ Example.airFriction = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/avalanche.js b/examples/avalanche.js index e8c0a4a..cb625d1 100644 --- a/examples/avalanche.js +++ b/examples/avalanche.js @@ -21,7 +21,6 @@ Example.avalanche = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -50,9 +49,9 @@ Example.avalanche = function() { return Bodies.circle(x, y, Common.random(10, 20), { friction: 0.00001, restitution: 0.5, density: 0.001 }); }); - World.add(world, stack); + Composite.add(world, stack); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(200, 150, 700, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' } }), Bodies.rectangle(500, 350, 700, 20, { isStatic: true, angle: -Math.PI * 0.06, render: { fillStyle: '#060a19' } }), Bodies.rectangle(340, 580, 700, 20, { isStatic: true, angle: Math.PI * 0.04, render: { fillStyle: '#060a19' } }) @@ -70,7 +69,7 @@ Example.avalanche = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/ballPool.js b/examples/ballPool.js index f7708c4..7c57ac1 100644 --- a/examples/ballPool.js +++ b/examples/ballPool.js @@ -21,7 +21,6 @@ Example.ballPool = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -46,7 +45,7 @@ Example.ballPool = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, 600, 1200, 50.5, { isStatic: true, render: { fillStyle: '#060a19' } }) ]); @@ -54,7 +53,7 @@ Example.ballPool = function() { return Bodies.circle(x, y, Common.random(15, 30), { restitution: 0.6, friction: 0.1 }); }); - World.add(world, [ + Composite.add(world, [ stack, Bodies.polygon(200, 460, 3, 60), Bodies.polygon(400, 460, 5, 60), @@ -73,7 +72,7 @@ Example.ballPool = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/bridge.js b/examples/bridge.js index 9b23fa6..c44a99a 100644 --- a/examples/bridge.js +++ b/examples/bridge.js @@ -10,7 +10,7 @@ Example.bridge = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -61,7 +61,7 @@ Example.bridge = function() { return Bodies.rectangle(x, y, 50, 50, Common.random(20, 40)); }); - World.add(world, [ + Composite.add(world, [ bridge, stack, Bodies.rectangle(30, 490, 220, 380, { @@ -100,7 +100,7 @@ Example.bridge = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/broadphase.js b/examples/broadphase.js index d56e696..deb7963 100644 --- a/examples/broadphase.js +++ b/examples/broadphase.js @@ -8,7 +8,7 @@ Example.broadphase = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -34,7 +34,7 @@ Example.broadphase = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -57,7 +57,7 @@ Example.broadphase = function() { } }); - World.add(world, stack); + Composite.add(world, stack); // add mouse control var mouse = Mouse.create(render.canvas), @@ -71,7 +71,7 @@ Example.broadphase = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/car.js b/examples/car.js index 522fc42..8474684 100644 --- a/examples/car.js +++ b/examples/car.js @@ -7,7 +7,7 @@ Example.car = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -33,7 +33,7 @@ Example.car = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -43,12 +43,12 @@ Example.car = function() { // see car function defined later in this file var scale = 0.9; - World.add(world, Example.car.car(150, 100, 150 * scale, 30 * scale, 30 * scale)); + Composite.add(world, Example.car.car(150, 100, 150 * scale, 30 * scale, 30 * scale)); scale = 0.8; - World.add(world, Example.car.car(350, 300, 150 * scale, 30 * scale, 30 * scale)); + Composite.add(world, Example.car.car(350, 300, 150 * scale, 30 * scale, 30 * scale)); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(200, 150, 400, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' }}), Bodies.rectangle(500, 350, 650, 20, { isStatic: true, angle: -Math.PI * 0.06, render: { fillStyle: '#060a19' }}), Bodies.rectangle(300, 560, 600, 20, { isStatic: true, angle: Math.PI * 0.04, render: { fillStyle: '#060a19' }}) @@ -66,7 +66,7 @@ Example.car = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/catapult.js b/examples/catapult.js index be765f7..ab8c5e0 100644 --- a/examples/catapult.js +++ b/examples/catapult.js @@ -8,7 +8,7 @@ Example.catapult = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies, Body = Matter.Body, Vector = Matter.Vector; @@ -45,7 +45,7 @@ Example.catapult = function() { var catapult = Bodies.rectangle(400, 520, 320, 20, { collisionFilter: { group: group } }); - World.add(world, [ + Composite.add(world, [ stack, catapult, Bodies.rectangle(400, 600, 800, 50.5, { isStatic: true, render: { fillStyle: '#060a19' } }), @@ -72,7 +72,7 @@ Example.catapult = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/chains.js b/examples/chains.js index 93cab24..c413dc9 100644 --- a/examples/chains.js +++ b/examples/chains.js @@ -10,7 +10,6 @@ Example.chains = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -79,7 +78,7 @@ Example.chains = function() { stiffness: 0.5 })); - World.add(world, [ + Composite.add(world, [ ropeA, ropeB, ropeC, @@ -98,7 +97,7 @@ Example.chains = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/circleStack.js b/examples/circleStack.js index ef98a28..cfaff6d 100644 --- a/examples/circleStack.js +++ b/examples/circleStack.js @@ -7,7 +7,7 @@ Example.circleStack = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -36,7 +36,7 @@ Example.circleStack = function() { return Bodies.circle(x, y, 20); }); - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -57,7 +57,7 @@ Example.circleStack = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/cloth.js b/examples/cloth.js index 9ff9ea8..87ab928 100644 --- a/examples/cloth.js +++ b/examples/cloth.js @@ -8,7 +8,7 @@ Example.cloth = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -38,7 +38,7 @@ Example.cloth = function() { cloth.bodies[i].isStatic = true; } - World.add(world, [ + Composite.add(world, [ cloth, Bodies.circle(300, 500, 80, { isStatic: true, render: { fillStyle: '#060a19' }}), Bodies.rectangle(500, 480, 80, 80, { isStatic: true, render: { fillStyle: '#060a19' }}), @@ -57,7 +57,7 @@ Example.cloth = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/collisionFiltering.js b/examples/collisionFiltering.js index 0cc26b7..a396b01 100644 --- a/examples/collisionFiltering.js +++ b/examples/collisionFiltering.js @@ -9,7 +9,6 @@ Example.collisionFiltering = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -44,7 +43,7 @@ Example.collisionFiltering = function() { colorC = '#f5d259'; // add floor - World.add(world, Bodies.rectangle(400, 600, 900, 50, { + Composite.add(world, Bodies.rectangle(400, 600, 900, 50, { isStatic: true, render: { fillStyle: 'transparent', @@ -53,7 +52,7 @@ Example.collisionFiltering = function() { })); // create a stack with varying body categories (but these bodies can all collide with each other) - World.add(world, + Composite.add(world, Composites.stack(275, 100, 5, 9, 10, 10, function(x, y, column, row) { var category = redCategory, color = colorA; @@ -80,7 +79,7 @@ Example.collisionFiltering = function() { ); // this body will only collide with the walls and the green bodies - World.add(world, + Composite.add(world, Bodies.circle(310, 40, 30, { collisionFilter: { mask: defaultCategory | greenCategory @@ -92,7 +91,7 @@ Example.collisionFiltering = function() { ); // this body will only collide with the walls and the red bodies - World.add(world, + Composite.add(world, Bodies.circle(400, 40, 30, { collisionFilter: { mask: defaultCategory | redCategory @@ -104,7 +103,7 @@ Example.collisionFiltering = function() { ); // this body will only collide with the walls and the blue bodies - World.add(world, + Composite.add(world, Bodies.circle(480, 40, 30, { collisionFilter: { mask: defaultCategory | blueCategory @@ -127,7 +126,7 @@ Example.collisionFiltering = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/compositeManipulation.js b/examples/compositeManipulation.js index 2d1ed57..5633be3 100644 --- a/examples/compositeManipulation.js +++ b/examples/compositeManipulation.js @@ -9,7 +9,6 @@ Example.compositeManipulation = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -34,7 +33,7 @@ Example.compositeManipulation = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -46,7 +45,7 @@ Example.compositeManipulation = function() { return Bodies.rectangle(x, y, 40, 40); }); - World.add(world, stack); + Composite.add(world, stack); world.gravity.y = 0; @@ -83,7 +82,7 @@ Example.compositeManipulation = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/compound.js b/examples/compound.js index 4aaaa6b..a098552 100644 --- a/examples/compound.js +++ b/examples/compound.js @@ -6,9 +6,9 @@ Example.compound = function() { Runner = Matter.Runner, Body = Matter.Body, Constraint = Matter.Constraint, + Composite = Matter.Composite, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -63,7 +63,7 @@ Example.compound = function() { pointB: { x: 0, y: 0 } }); - World.add(world, [ + Composite.add(world, [ compoundBodyA, compoundBodyB, constraint, @@ -82,7 +82,7 @@ Example.compound = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/compoundStack.js b/examples/compoundStack.js index 5463467..3bb2ca4 100644 --- a/examples/compoundStack.js +++ b/examples/compoundStack.js @@ -8,7 +8,7 @@ Example.compoundStack = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -44,7 +44,7 @@ Example.compoundStack = function() { }); }); - World.add(world, [ + Composite.add(world, [ stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), @@ -65,7 +65,7 @@ Example.compoundStack = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/concave.js b/examples/concave.js index 517b07f..e961db9 100644 --- a/examples/concave.js +++ b/examples/concave.js @@ -8,7 +8,7 @@ Example.concave = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Vertices = Matter.Vertices, Bodies = Matter.Bodies; @@ -36,7 +36,7 @@ Example.concave = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -60,7 +60,7 @@ Example.concave = function() { }, true); }); - World.add(world, stack); + Composite.add(world, stack); // add mouse control var mouse = Mouse.create(render.canvas), @@ -74,7 +74,7 @@ Example.concave = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/constraints.js b/examples/constraints.js index 851c4bd..b0aaa00 100644 --- a/examples/constraints.js +++ b/examples/constraints.js @@ -9,7 +9,7 @@ Example.constraints = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -42,7 +42,7 @@ Example.constraints = function() { pointB: { x: -10, y: -10 } }); - World.add(world, [body, constraint]); + Composite.add(world, [body, constraint]); // add soft global constraint var body = Bodies.polygon(280, 100, 3, 30); @@ -54,7 +54,7 @@ Example.constraints = function() { stiffness: 0.001 }); - World.add(world, [body, constraint]); + Composite.add(world, [body, constraint]); // add damped soft global constraint var body = Bodies.polygon(400, 100, 4, 30); @@ -67,7 +67,7 @@ Example.constraints = function() { damping: 0.05 }); - World.add(world, [body, constraint]); + Composite.add(world, [body, constraint]); // add revolute constraint var body = Bodies.rectangle(600, 200, 200, 20); @@ -79,7 +79,7 @@ Example.constraints = function() { length: 0 }); - World.add(world, [body, ball, constraint]); + Composite.add(world, [body, ball, constraint]); // add revolute multi-body constraint var body = Bodies.rectangle(500, 400, 100, 20, { collisionFilter: { group: -1 } }); @@ -90,7 +90,7 @@ Example.constraints = function() { bodyB: ball }); - World.add(world, [body, ball, constraint]); + Composite.add(world, [body, ball, constraint]); // add stiff multi-body constraint var bodyA = Bodies.polygon(100, 400, 6, 20); @@ -103,7 +103,7 @@ Example.constraints = function() { pointB: { x: -10, y: -10 } }); - World.add(world, [bodyA, bodyB, constraint]); + Composite.add(world, [bodyA, bodyB, constraint]); // add soft global constraint var bodyA = Bodies.polygon(300, 400, 4, 20); @@ -117,7 +117,7 @@ Example.constraints = function() { stiffness: 0.001 }); - World.add(world, [bodyA, bodyB, constraint]); + Composite.add(world, [bodyA, bodyB, constraint]); // add damped soft global constraint var bodyA = Bodies.polygon(500, 400, 6, 30); @@ -132,9 +132,9 @@ Example.constraints = function() { damping: 0.1 }); - World.add(world, [bodyA, bodyB, constraint]); + Composite.add(world, [bodyA, bodyB, constraint]); - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -155,7 +155,7 @@ Example.constraints = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/doublePendulum.js b/examples/doublePendulum.js index 4cf6f2c..a93bc32 100644 --- a/examples/doublePendulum.js +++ b/examples/doublePendulum.js @@ -11,7 +11,6 @@ Example.doublePendulum = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies, Vector = Matter.Vector; @@ -82,7 +81,7 @@ Example.doublePendulum = function() { y: lowerArm.position.y }); - World.add(world, pendulum); + Composite.add(world, pendulum); var trail = []; @@ -124,7 +123,7 @@ Example.doublePendulum = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/events.js b/examples/events.js index ff4b3e2..9c2edd2 100644 --- a/examples/events.js +++ b/examples/events.js @@ -11,7 +11,6 @@ Example.events = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -89,7 +88,7 @@ Example.events = function() { var bodyStyle = { fillStyle: '#222' }; // scene code - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, 0, 800, 50, { isStatic: true, render: bodyStyle }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true, render: bodyStyle }), Bodies.rectangle(800, 300, 50, 600, { isStatic: true, render: bodyStyle }), @@ -100,7 +99,7 @@ Example.events = function() { return Bodies.circle(x, y, 15, { restitution: 1, render: bodyStyle }); }); - World.add(world, stack); + Composite.add(world, stack); var shakeScene = function(engine) { var bodies = Composite.allBodies(engine.world); @@ -131,7 +130,7 @@ Example.events = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/friction.js b/examples/friction.js index 1ffcb5b..bb53f1f 100644 --- a/examples/friction.js +++ b/examples/friction.js @@ -6,7 +6,7 @@ Example.friction = function() { Runner = Matter.Runner, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -31,7 +31,7 @@ Example.friction = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -39,17 +39,17 @@ Example.friction = function() { Bodies.rectangle(0, 300, 50, 600, { isStatic: true }) ]); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(300, 180, 700, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' } }), Bodies.rectangle(300, 70, 40, 40, { friction: 0.001 }) ]); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(300, 350, 700, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' } }), Bodies.rectangle(300, 250, 40, 40, { friction: 0.0005 }) ]); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(300, 520, 700, 20, { isStatic: true, angle: Math.PI * 0.06, render: { fillStyle: '#060a19' } }), Bodies.rectangle(300, 430, 40, 40, { friction: 0 }) ]); @@ -66,7 +66,7 @@ Example.friction = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/gravity.js b/examples/gravity.js index adb03b9..2608279 100644 --- a/examples/gravity.js +++ b/examples/gravity.js @@ -8,7 +8,7 @@ Example.gravity = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -34,7 +34,7 @@ Example.gravity = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50.5, { isStatic: true }), Bodies.rectangle(800, 300, 50, 600, { isStatic: true }), @@ -58,7 +58,7 @@ Example.gravity = function() { } }); - World.add(world, stack); + Composite.add(world, stack); // add mouse control var mouse = Mouse.create(render.canvas), @@ -72,7 +72,7 @@ Example.gravity = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/gyro.js b/examples/gyro.js index 35a7fc1..47be398 100644 --- a/examples/gyro.js +++ b/examples/gyro.js @@ -8,7 +8,7 @@ Example.gyro = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -59,7 +59,7 @@ Example.gyro = function() { } }); - World.add(world, [ + Composite.add(world, [ stack, Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -103,7 +103,7 @@ Example.gyro = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/manipulation.js b/examples/manipulation.js index 37f1136..efbeb76 100644 --- a/examples/manipulation.js +++ b/examples/manipulation.js @@ -8,7 +8,7 @@ Example.manipulation = function() { Events = Matter.Events, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -49,9 +49,9 @@ Example.manipulation = function() { isStatic: true }); - World.add(world, [bodyA, bodyB, bodyC, bodyD, bodyE, bodyF, bodyG, compound]); + Composite.add(world, [bodyA, bodyB, bodyC, bodyD, bodyE, bodyF, bodyG, compound]); - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -116,7 +116,7 @@ Example.manipulation = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/mixed.js b/examples/mixed.js index e6c6eb0..447c9b0 100644 --- a/examples/mixed.js +++ b/examples/mixed.js @@ -8,7 +8,7 @@ Example.mixed = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -59,9 +59,9 @@ Example.mixed = function() { } }); - World.add(world, stack); + Composite.add(world, stack); - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -81,7 +81,7 @@ Example.mixed = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/newtonsCradle.js b/examples/newtonsCradle.js index 6e08aca..7aaf66a 100644 --- a/examples/newtonsCradle.js +++ b/examples/newtonsCradle.js @@ -8,7 +8,7 @@ Example.newtonsCradle = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World; + Composite = Matter.Composite; // create engine var engine = Engine.create(), @@ -33,11 +33,11 @@ Example.newtonsCradle = function() { // see newtonsCradle function defined later in this file var cradle = Example.newtonsCradle.newtonsCradle(280, 100, 5, 30, 200); - World.add(world, cradle); + Composite.add(world, cradle); Body.translate(cradle.bodies[0], { x: -180, y: -100 }); cradle = Example.newtonsCradle.newtonsCradle(280, 380, 7, 20, 140); - World.add(world, cradle); + Composite.add(world, cradle); Body.translate(cradle.bodies[0], { x: -140, y: -100 }); // add mouse control @@ -52,7 +52,7 @@ Example.newtonsCradle = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/pyramid.js b/examples/pyramid.js index 521bb06..e971836 100644 --- a/examples/pyramid.js +++ b/examples/pyramid.js @@ -7,7 +7,7 @@ Example.pyramid = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -36,7 +36,7 @@ Example.pyramid = function() { return Bodies.rectangle(x, y, 40, 40); }); - World.add(world, [ + Composite.add(world, [ stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), @@ -57,7 +57,7 @@ Example.pyramid = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/ragdoll.js b/examples/ragdoll.js index 172964a..0d48cc1 100644 --- a/examples/ragdoll.js +++ b/examples/ragdoll.js @@ -12,7 +12,6 @@ Example.ragdoll = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies, Vector = Matter.Vector; @@ -80,7 +79,7 @@ Example.ragdoll = function() { Composite.add(ragdolls, ragdoll); } - World.add(world, [stack, obstacles, ragdolls]); + Composite.add(world, [stack, obstacles, ragdolls]); var timeScaleTarget = 1, counter = 0; @@ -173,7 +172,7 @@ Example.ragdoll = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/raycasting.js b/examples/raycasting.js index ea9f023..4e512c9 100644 --- a/examples/raycasting.js +++ b/examples/raycasting.js @@ -11,7 +11,6 @@ Example.raycasting = function() { MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, Events = Matter.Events, - World = Matter.World, Vertices = Matter.Vertices, Bodies = Matter.Bodies; @@ -59,7 +58,7 @@ Example.raycasting = function() { var star = Vertices.fromPath('50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38'), concave = Bodies.fromVertices(200, 200, star); - World.add(world, [ + Composite.add(world, [ stack, concave, // walls @@ -114,7 +113,7 @@ Example.raycasting = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/restitution.js b/examples/restitution.js index 9860a05..d4b06c4 100644 --- a/examples/restitution.js +++ b/examples/restitution.js @@ -6,7 +6,7 @@ Example.restitution = function() { Runner = Matter.Runner, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -36,7 +36,7 @@ Example.restitution = function() { var rest = 0.9, space = 600 / 5; - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(100 + space * 0, 150, 50, 50, { restitution: rest }), Bodies.rectangle(100 + space * 1, 150, 50, 50, { restitution: rest, angle: -Math.PI * 0.15 }), Bodies.rectangle(100 + space * 2, 150, 50, 50, { restitution: rest, angle: -Math.PI * 0.25 }), @@ -61,7 +61,7 @@ Example.restitution = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/rounded.js b/examples/rounded.js index b2767c5..2de1245 100644 --- a/examples/rounded.js +++ b/examples/rounded.js @@ -6,7 +6,7 @@ Example.rounded = function() { Runner = Matter.Runner, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -31,7 +31,7 @@ Example.rounded = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -39,7 +39,7 @@ Example.rounded = function() { Bodies.rectangle(0, 300, 50, 600, { isStatic: true }) ]); - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(200, 200, 100, 100, { chamfer: { radius: 20 } }), @@ -85,7 +85,7 @@ Example.rounded = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/sensors.js b/examples/sensors.js index 07e560d..9c413b1 100644 --- a/examples/sensors.js +++ b/examples/sensors.js @@ -7,7 +7,7 @@ Example.sensors = function() { Events = Matter.Events, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -45,7 +45,7 @@ Example.sensors = function() { } }); - World.add(world, [ + Composite.add(world, [ collider, Bodies.rectangle(400, 600, 800, 50, { isStatic: true, @@ -56,7 +56,7 @@ Example.sensors = function() { }) ]); - World.add(world, + Composite.add(world, Bodies.circle(400, 40, 30, { render: { strokeStyle: colorB, @@ -106,7 +106,7 @@ Example.sensors = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/sleeping.js b/examples/sleeping.js index 0966da5..8d78648 100644 --- a/examples/sleeping.js +++ b/examples/sleeping.js @@ -9,7 +9,7 @@ Example.sleeping = function() { Events = Matter.Events, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -36,7 +36,7 @@ Example.sleeping = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -59,7 +59,7 @@ Example.sleeping = function() { } }); - World.add(world, stack); + Composite.add(world, stack); for (var i = 0; i < stack.bodies.length; i++) { Events.on(stack.bodies[i], 'sleepStart sleepEnd', function(event) { @@ -80,7 +80,7 @@ Example.sleeping = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/slingshot.js b/examples/slingshot.js index 083f460..b93f9b5 100644 --- a/examples/slingshot.js +++ b/examples/slingshot.js @@ -9,7 +9,7 @@ Example.slingshot = function() { Constraint = Matter.Constraint, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -54,12 +54,12 @@ Example.slingshot = function() { return Bodies.rectangle(x, y, 25, 40); }); - World.add(engine.world, [ground, pyramid, ground2, pyramid2, rock, elastic]); + Composite.add(engine.world, [ground, pyramid, ground2, pyramid2, rock, elastic]); Events.on(engine, 'afterUpdate', function() { if (mouseConstraint.mouse.button === -1 && (rock.position.x > 190 || rock.position.y < 430)) { rock = Bodies.polygon(170, 450, 7, 20, rockOptions); - World.add(engine.world, rock); + Composite.add(engine.world, rock); elastic.bodyB = rock; } }); @@ -76,7 +76,7 @@ Example.slingshot = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/softBody.js b/examples/softBody.js index 226df0b..1d2e3ca 100644 --- a/examples/softBody.js +++ b/examples/softBody.js @@ -7,7 +7,7 @@ Example.softBody = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -38,7 +38,7 @@ Example.softBody = function() { render: { visible: true } }; - World.add(world, [ + Composite.add(world, [ // see softBody function defined later in this file Example.softBody.softBody(250, 100, 5, 5, 0, 0, true, 18, particleOptions), Example.softBody.softBody(400, 300, 8, 3, 0, 0, true, 15, particleOptions), @@ -62,7 +62,7 @@ Example.softBody = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/sprites.js b/examples/sprites.js index 44c14ef..7f9191d 100644 --- a/examples/sprites.js +++ b/examples/sprites.js @@ -8,7 +8,7 @@ Example.sprites = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -42,7 +42,7 @@ Example.sprites = function() { world.bodies = []; // these static walls will not be rendered in this sprites example, see options - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, -offset, 800.5 + 2 * offset, 50.5, options), Bodies.rectangle(400, 600 + offset, 800.5 + 2 * offset, 50.5, options), Bodies.rectangle(800 + offset, 300, 50.5, 600.5 + 2 * offset, options), @@ -74,7 +74,7 @@ Example.sprites = function() { } }); - World.add(world, stack); + Composite.add(world, stack); // add mouse control var mouse = Mouse.create(render.canvas), @@ -88,7 +88,7 @@ Example.sprites = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/stack.js b/examples/stack.js index ecbc96b..1d1320a 100644 --- a/examples/stack.js +++ b/examples/stack.js @@ -7,7 +7,7 @@ Example.stack = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -36,7 +36,7 @@ Example.stack = function() { return Bodies.rectangle(x, y, 40, 40); }); - World.add(world, [ + Composite.add(world, [ stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), @@ -57,7 +57,7 @@ Example.stack = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/staticFriction.js b/examples/staticFriction.js index 1f42ef9..ea8f89b 100644 --- a/examples/staticFriction.js +++ b/examples/staticFriction.js @@ -9,7 +9,7 @@ Example.staticFriction = function() { Events = Matter.Events, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -46,7 +46,7 @@ Example.staticFriction = function() { }); }); - World.add(world, [ + Composite.add(world, [ body, stack, // walls @@ -82,7 +82,7 @@ Example.staticFriction = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/stress.js b/examples/stress.js index 5ef6ae6..7bb8b99 100644 --- a/examples/stress.js +++ b/examples/stress.js @@ -7,7 +7,7 @@ Example.stress = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -35,7 +35,7 @@ Example.stress = function() { return Bodies.rectangle(x, y, 35, 35); }); - World.add(world, [ + Composite.add(world, [ stack, Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -55,7 +55,7 @@ Example.stress = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/stress2.js b/examples/stress2.js index 7af50f3..00ae76f 100644 --- a/examples/stress2.js +++ b/examples/stress2.js @@ -7,7 +7,7 @@ Example.stress2 = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Bodies = Matter.Bodies; // create engine @@ -35,7 +35,7 @@ Example.stress2 = function() { return Bodies.rectangle(x, y, 25, 25); }); - World.add(world, [ + Composite.add(world, [ stack, Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), @@ -55,7 +55,7 @@ Example.stress2 = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/svg.js b/examples/svg.js index 186def8..7c569bc 100644 --- a/examples/svg.js +++ b/examples/svg.js @@ -7,7 +7,7 @@ Example.svg = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Vertices = Matter.Vertices, Svg = Matter.Svg, Bodies = Matter.Bodies; @@ -59,7 +59,7 @@ Example.svg = function() { var vertexSets = select(root, 'path') .map(function(path) { return Vertices.scale(Svg.pathToVertices(path, 30), 0.4, 0.4); }); - World.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, { + Composite.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, { render: { fillStyle: color, strokeStyle: color, @@ -75,7 +75,7 @@ Example.svg = function() { var vertexSets = select(root, 'path') .map(function(path) { return Svg.pathToVertices(path, 30); }); - World.add(world, Bodies.fromVertices(400, 80, vertexSets, { + Composite.add(world, Bodies.fromVertices(400, 80, vertexSets, { render: { fillStyle: color, strokeStyle: color, @@ -87,7 +87,7 @@ Example.svg = function() { Common.warn('Fetch is not available. Could not load SVG.'); } - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), Bodies.rectangle(800, 300, 50, 600, { isStatic: true }), @@ -106,7 +106,7 @@ Example.svg = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/terrain.js b/examples/terrain.js index e6c6f17..2553f47 100644 --- a/examples/terrain.js +++ b/examples/terrain.js @@ -8,7 +8,7 @@ Example.terrain = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Query = Matter.Query, Svg = Matter.Svg, Bodies = Matter.Bodies; @@ -63,7 +63,7 @@ Example.terrain = function() { } }, true); - World.add(world, terrain); + Composite.add(world, terrain); var bodyOptions = { frictionAir: 0, @@ -71,7 +71,7 @@ Example.terrain = function() { restitution: 0.6 }; - World.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y) { + Composite.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y) { if (Query.point([terrain], { x: x, y: y }).length === 0) { return Bodies.polygon(x, y, 5, 12, bodyOptions); } @@ -93,7 +93,7 @@ Example.terrain = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/timescale.js b/examples/timescale.js index f141a9d..6abb473 100644 --- a/examples/timescale.js +++ b/examples/timescale.js @@ -11,7 +11,6 @@ Example.timescale = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, Bodies = Matter.Bodies; // create engine @@ -36,7 +35,7 @@ Example.timescale = function() { Runner.run(runner, engine); // add bodies - World.add(world, [ + Composite.add(world, [ Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), Bodies.rectangle(800, 300, 50, 600, { isStatic: true }), @@ -95,12 +94,12 @@ Example.timescale = function() { }; // add some small bouncy circles... remember Swordfish? - World.add(world, Composites.stack(20, 100, 15, 3, 20, 40, function(x, y) { + Composite.add(world, Composites.stack(20, 100, 15, 3, 20, 40, function(x, y) { return Bodies.circle(x, y, Common.random(10, 20), bodyOptions); })); // add some larger random bouncy objects - World.add(world, Composites.stack(50, 50, 8, 3, 0, 0, function(x, y) { + Composite.add(world, Composites.stack(50, 50, 8, 3, 0, 0, function(x, y) { switch (Math.round(Common.random(0, 1))) { case 0: @@ -127,7 +126,7 @@ Example.timescale = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; diff --git a/examples/views.js b/examples/views.js index 2ede02e..bbb8492 100644 --- a/examples/views.js +++ b/examples/views.js @@ -9,7 +9,7 @@ Example.views = function() { Common = Matter.Common, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Vector = Matter.Vector, Bounds = Matter.Bounds, Bodies = Matter.Bodies; @@ -48,7 +48,7 @@ Example.views = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; @@ -70,7 +70,7 @@ Example.views = function() { } }); - World.add(world, [ + Composite.add(world, [ stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), diff --git a/examples/wreckingBall.js b/examples/wreckingBall.js index 2db3417..4b5df30 100644 --- a/examples/wreckingBall.js +++ b/examples/wreckingBall.js @@ -7,7 +7,7 @@ Example.wreckingBall = function() { Composites = Matter.Composites, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, - World = Matter.World, + Composite = Matter.Composite, Constraint = Matter.Constraint, Bodies = Matter.Bodies; @@ -40,7 +40,7 @@ Example.wreckingBall = function() { return Bodies.rectangle(x, y, 40, 40); }); - World.add(world, [ + Composite.add(world, [ stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), @@ -51,8 +51,8 @@ Example.wreckingBall = function() { var ball = Bodies.circle(100, 400, 50, { density: 0.04, frictionAir: 0.005}); - World.add(world, ball); - World.add(world, Constraint.create({ + Composite.add(world, ball); + Composite.add(world, Constraint.create({ pointA: { x: 300, y: 100 }, bodyB: ball })); @@ -69,7 +69,7 @@ Example.wreckingBall = function() { } }); - World.add(world, mouseConstraint); + Composite.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse;