Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rubenwardy
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenwardy/d08745dcacee4687bfb4 to your computer and use it in GitHub Desktop.
Save rubenwardy/d08745dcacee4687bfb4 to your computer and use it in GitHub Desktop.
# replace lines 6 to 20 in scripts/strings.js with this
var ROPE_LENGTH = 0.04; // the equilibirum length of each rope
var ROPE_LENGTH_SQ = ROPE_LENGTH * ROPE_LENGTH; // square of the rope length
var ROPE_SPACING = 0.04; // initial horizontal distance between vertices
var ROPE_MASS = 0.00003; // Mass per length of rope (actually the mass of vertices)
function isPaused() {
return game.paused || game.drawmode;
}
// Start
function init(){
for (var i=0; i<200; i++) {
createVertex(ROPE_SPACING * i, 0, false);
}
points[0].fixed = true;
points[points.length-1].fixed = true;
for (var i=0; i<199; i++) {
joinVertices(i, i + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment