diff --git a/app/Game/Client/GameObjects/Items/RubeDoll.js b/app/Game/Client/GameObjects/Items/RubeDoll.js index bed947c..0d26139 100644 --- a/app/Game/Client/GameObjects/Items/RubeDoll.js +++ b/app/Game/Client/GameObjects/Items/RubeDoll.js @@ -95,8 +95,6 @@ function (Parent, Layer, Settings, Nc) { this.characterName = "Chuck"; this.lastFlipDirection = -options.direction || 1; - console.log(this.lastFlipDirection); - Parent.call(this, physicsEngine, uid, options); } @@ -169,6 +167,8 @@ function (Parent, Layer, Settings, Nc) { }; RubeDoll.prototype.render = function() { + Parent.prototype.render.call(this); + if(this.limbs) { for(var name in this.limbMeshes) { if(this.limbs[name]) { diff --git a/app/Game/Config/ItemSettings.js b/app/Game/Config/ItemSettings.js index 532d6fc..bd3b282 100644 --- a/app/Game/Config/ItemSettings.js +++ b/app/Game/Config/ItemSettings.js @@ -421,7 +421,7 @@ function () { "height": "9", "type": "rubedoll", - "grabAngle": "0", + "grabAngle": "0.1", } }; diff --git a/app/Game/Config/Settings.js b/app/Game/Config/Settings.js index 4e2f669..4cc8800 100755 --- a/app/Game/Config/Settings.js +++ b/app/Game/Config/Settings.js @@ -16,8 +16,8 @@ function () { BOX2D_WORLD_AABB_SIZE: 3000, BOX2D_ALLOW_SLEEP: true, BOX2D_GRAVITY: 26, - BOX2D_VELOCITY_ITERATIONS: 10, - BOX2D_POSITION_ITERATIONS: 6, + BOX2D_VELOCITY_ITERATIONS: 200, + BOX2D_POSITION_ITERATIONS: 100, BOX2D_TIME_STEP: 1 / 60, // PATHS diff --git a/app/Game/Core/GameObjects/Items/RubeDoll.js b/app/Game/Core/GameObjects/Items/RubeDoll.js index d85aff2..367435c 100644 --- a/app/Game/Core/GameObjects/Items/RubeDoll.js +++ b/app/Game/Core/GameObjects/Items/RubeDoll.js @@ -30,6 +30,7 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) { Parent.call(this, physicsEngine, uid, options); world.DestroyBody(this.body); this.body = this.limbs.chest; + delete this.limbs.chest; this.body.SetUserData(this); @@ -80,7 +81,9 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) { }; RubeDoll.prototype.flip = function(direction) { + Parent.prototype.flip.call(this, direction); + /* for (var i in this.joints) { var joint = this.joints[i]; @@ -102,19 +105,28 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) { joint.SetLimits(a2, a1); } } - } + }*/ }; RubeDoll.prototype.reposition = function(handPosition, direction) { + var oldPosition = this.getPosition(); + Parent.prototype.reposition.call(this, handPosition, direction); - var position = new Box2D.Common.Math.b2Vec2( - handPosition.x + ((6 / Settings.RATIO) * direction), - handPosition.y - ); + //this.body.SetType(Box2D.Dynamics.b2Body.b2_staticBody) + + var newPosition = this.getPosition(); + var b2Math = Box2D.Common.Math.b2Math; + var offset = b2Math.SubtractVV(newPosition, oldPosition); + + for(var limb in this.limbs) { + var position = this.limbs[limb].GetPosition().Copy(); + position.Add(offset); + this.limbs[limb].SetPosition(position); + //this.limbs[limb].SetType(Box2D.Dynamics.b2Body.b2_staticBody) + } - this.body.SetPosition(position); }; RubeDoll.prototype.setVelocities = function(options) { diff --git a/static/maps/tiled/debug.json b/static/maps/tiled/debug.json index b26ed3f..120737a 100644 --- a/static/maps/tiled/debug.json +++ b/static/maps/tiled/debug.json @@ -225,7 +225,7 @@ "visible":true, "width":0, "x":504.607333333333, - "y":111.255333333333 + "y":433.26 }, { "height":0,