2015-08-25 14:12:52 -04:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
var World = Matter.World,
|
|
|
|
Bodies = Matter.Bodies,
|
|
|
|
Body = Matter.Body,
|
|
|
|
Composites = Matter.Composites;
|
|
|
|
|
|
|
|
Example.compoundStack = function(demo) {
|
|
|
|
var engine = demo.engine,
|
2015-11-29 09:27:38 -05:00
|
|
|
world = engine.world,
|
|
|
|
size = 50;
|
2015-08-25 14:12:52 -04:00
|
|
|
|
2015-08-25 14:31:44 -04:00
|
|
|
var stack = Composites.stack(100, 220, 12, 6, 0, 0, function(x, y) {
|
2015-08-25 14:12:52 -04:00
|
|
|
var partA = Bodies.rectangle(x, y, size, size / 5),
|
|
|
|
partB = Bodies.rectangle(x, y, size / 5, size, { render: partA.render });
|
|
|
|
|
|
|
|
return Body.create({
|
|
|
|
parts: [partA, partB]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
World.add(world, stack);
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|