Skip to content

Commit

Permalink
improved examples
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Dec 23, 2015
1 parent 1db98a3 commit 6e1f8e9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/circleStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 100, 10, 10, 20, 0, function(x, y) {
var stack = Composites.stack(100, 185, 10, 10, 20, 0, function(x, y) {
return Bodies.circle(x, y, 20);
});

World.add(world, stack);
};

})();
})();
4 changes: 2 additions & 2 deletions examples/compoundStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
world = engine.world,
size = 50;

var stack = Composites.stack(100, 220, 12, 6, 0, 0, function(x, y) {
var stack = Composites.stack(100, 280, 12, 6, 0, 0, function(x, y) {
var partA = Bodies.rectangle(x, y, size, size / 5),
partB = Bodies.rectangle(x, y, size / 5, size, { render: partA.render });

Expand All @@ -22,4 +22,4 @@
World.add(world, stack);
};

})();
})();
4 changes: 2 additions & 2 deletions examples/softBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

World.add(world, [
Composites.softBody(250, 100, 5, 5, 0, 0, true, 18, particleOptions),
Composites.softBody(250, 300, 8, 3, 0, 0, true, 15, particleOptions),
Composites.softBody(400, 300, 8, 3, 0, 0, true, 15, particleOptions),
Composites.softBody(250, 400, 4, 4, 0, 0, true, 15, particleOptions)
]);

var renderOptions = engine.render.options;
renderOptions.showAngleIndicator = false;
};

})();
})();
4 changes: 2 additions & 2 deletions examples/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
var engine = demo.engine,
world = engine.world;

var stack = Composites.stack(100, 300, 10, 5, 0, 0, function(x, y) {
var stack = Composites.stack(100, 380, 10, 5, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, 40, 40);
});

World.add(world, stack);
};

})();
})();
2 changes: 1 addition & 1 deletion src/factory/Composites.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ var Bodies = require('./Bodies');
for (var i = 0; i < number; i++) {
var separation = 1.9,
circle = Bodies.circle(xx + i * (size * separation), yy + length, size,
{ inertia: 99999, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 0.01 }),
{ inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }),
constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle });

Composite.addBody(newtonsCradle, circle);
Expand Down
3 changes: 3 additions & 0 deletions src/render/Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ var Vector = require('../geometry/Vector');
for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) {
part = body.parts[k];

if (!part.render.visible)
continue;

if (part.render.sprite && part.render.sprite.texture && !options.wireframes) {
// part sprite
var sprite = part.render.sprite,
Expand Down

0 comments on commit 6e1f8e9

Please sign in to comment.