Skip to content

Commit

Permalink
Updates World default coefficient of friction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vince Allen committed Sep 14, 2014
1 parent 4f797a6 commit 4b79e55
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ System._addWorld = function(world) {
* @memberof System
* @param {string} [opt_klass = 'Item'] The name of the class to add.
* @param {Object} [opt_options=] A map of initial properties.
* @param {string=} [opt_world = System._records[0]] An instance of World to contain the item.
* @param {Object} [opt_world = System._records[0]] An instance of World to contain the item.
* @returns {Object} An instance of the added item.
*/
System.add = function(opt_klass, opt_options, opt_world) {
Expand Down Expand Up @@ -283,6 +283,7 @@ System._stepForward = function() {
}
}
}
System.clock++;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ World.prototype.init = function(world, opt_options) {
this.borderStyle = options.borderStyle || 'none';
this.borderColor = options.borderColor || [0, 0, 0];
this.gravity = options.gravity || new Vector(0, 1);
this.c = options.c || 0.1;
this.c = typeof options.c !== 'undefined' ? options.c : 0.1;
this.pauseStep = !!options.pauseStep;
this.pauseDraw = !!options.pauseDraw;
this.el.className = this.name.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion test/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ test('init() should initialize with default properties.', function(t) {
t.equal(obj.controlCamera, false, 'default controlCamera.');
t.equal(obj._force.x, 0, 'force cache x.');
t.equal(obj._force.y, 0, 'force cache y.');
t.equal(obj.id, 'Item3', 'should have an id.');
t.ok(obj.id, 'should have an id.');
t.equal(typeof obj.el, 'object', 'should have a DOM element as a view.');
t.equal(obj.el.style.position, 'absolute', 'should have absolute positioning.');
t.equal(obj.el.style.top, '-5000px', 'should be positioned off screen.');
Expand Down
6 changes: 3 additions & 3 deletions test/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('load World.', function(t) {
t.end();
});

test('new Item() should create a new Item and add its view to the DOM.', function(t) {
test('new World() creates a new World.', function(t) {
var obj = new World();
t.equal(obj.el, document.body, 'should by default use document.body as a view.');
t.equal(obj.name, 'World', 'should have a name.');
Expand Down Expand Up @@ -63,7 +63,7 @@ test('init() should initialize with custom properties.', function(t) {
borderStyle: 'dotted',
borderColor: [0, 0, 200],
gravity: new Vector(10, 20),
c: 10,
c: 0,
pauseStep: true,
pauseDraw: true,
location: new Vector(50, 50)
Expand All @@ -76,7 +76,7 @@ test('init() should initialize with custom properties.', function(t) {
t.assert(obj.borderColor[0] === 0 && obj.borderColor[1] === 0 && obj.borderColor[2] === 200, 'Custom borderColor.');
t.equal(obj.gravity.x, 10, 'Custom gravity x.');
t.equal(obj.gravity.y, 20, 'Custom gravity y.');
t.equal(obj.c, 10, 'Custom c.');
t.equal(obj.c, 0, 'Custom c.');
t.equal(obj.pauseStep, true, 'Custom pauseStep.');
t.equal(obj.pauseDraw, true, 'Custom pauseDraw.');
t.equal(obj.location.x, 50, 'Custom location x.');
Expand Down

0 comments on commit 4b79e55

Please sign in to comment.