Phaser.Physics.Spring = function (game, bodyA, bodyB, restLength, stiffness, damping, worldA, worldB, localA, localB){ this.game = game; if (typeof restLength === 'undefined') { restLength = 1; } if (typeof stiffness === 'undefined') { stiffness = 100; } if (typeof damping === 'undefined') { damping = 1; } var options = { restLength: restLength, stiffness: stiffness, damping: damping} ; if (typeof worldA !== 'undefined' && worldA !== null ) { options.worldAnchorA = [game.math.px2p(worldA[0]), game.math.px2p(worldA[1])] ; } if (typeof worldB !== 'undefined' && worldB !== null ) { options.worldAnchorB = [game.math.px2p(worldB[0]), game.math.px2p(worldB[1])] ; } if (typeof localA !== 'undefined' && localA !== null ) { options.localAnchorA = [game.math.px2p(localA[0]), game.math.px2p(localA[1])] ; } if (typeof localB !== 'undefined' && localB !== null ) { options.localAnchorB = [game.math.px2p(localB[0]), game.math.px2p(localB[1])] ; } p2.Spring.call(this, bodyA, bodyB, options); } ; Phaser.Physics.Spring.prototype = Object.create(p2.Spring.prototype); Phaser.Physics.Spring.prototype.constructor = Phaser.Physics.Spring;