fixes #78 revisited weight handycap

This commit is contained in:
Jeena 2015-02-15 01:38:16 +01:00
parent b6d67a0581
commit e404ad3598
7 changed files with 27 additions and 16 deletions

View file

@ -59,10 +59,13 @@ function (Parent, Item, Box2D, Nc) {
if(item.lastMoved && item.lastMoved.player != this.player) {
var damageVector = b2Math.SubtractVV(itemVelocity, ownVelocity);
damageVector.Abs();
damageVector.Multiply(0.7);
damageVector.Multiply(itemMass * 1.3);
var velocity = damageVector.Length();
damageVector.Multiply(itemMass / 3.6);
var damage = damageVector.Length();
damage *= item.options.danger ? item.options.danger : 1;
if(item.options.danger) {
damage += item.options.danger * 90 * (velocity / 128) * (itemMass + 1);
}
var player = item.lastMoved.player;

View file

@ -115,7 +115,11 @@ function (Parent, KeyboardInput, DomController, Settings, Swiper) {
self.playerController.handActionRequest(options);
} else {
self.swiper = new Swiper();
self.swiper.draw(e);
self.draw({
movementX: 0,
movementY: 0
});
}
}
@ -184,6 +188,7 @@ function (Parent, KeyboardInput, DomController, Settings, Swiper) {
this.mousePosition.x += movementX;
this.mousePosition.y += movementY;
this.swiper.swipe(this.mousePosition.x, -this.mousePosition.y);
};

View file

@ -2,6 +2,8 @@ define(function() {
var ItemSettings = {
// weight is a number between 0.1 for very light and 10 for very heavy
"Default":
{
"category": "",
@ -15,7 +17,7 @@ define(function() {
"rotation": "0",
"bounce": "0",
"grabAngle": "-1.5",
"danger": "1",
"danger": "0",
"bodyType": "dynamic",
},
@ -25,7 +27,7 @@ define(function() {
"image": "chest.png",
"type": "ragdoll",
"weight": "5",
"weight": "7",
"width": "6",
"height": "12",
@ -200,7 +202,7 @@ define(function() {
"category": "kitchen",
"image": "fridge.gif",
"weight": "10",
"weight": "5",
"width": "31",
"height": "53",
@ -213,11 +215,12 @@ define(function() {
"category": "kitchen",
"image": "microwave.gif",
"weight": "3.6",
"weight": "4.6",
"width": "19",
"height": "12",
"grabAngle": "-0.1",
"danger": "2",
},
"Coffeemachine":

View file

@ -36,7 +36,7 @@ define(function() {
WALK_SPEED: 4,
RUN_SPEED: 8,
FLY_SPEED: 6.2,
JUMP_SPEED: 21,
JUMP_SPEED: 19,
JUMP_STOP_DAMPING_FACTOR: 0.5,
MAX_THROW_FORCE: 28,
MAX_THROW_ANGULAR_VELOCITY: 3,
@ -51,7 +51,7 @@ define(function() {
TILE_FRICTION: 0.99,
TILE_RESTITUTION: 0.1,
PLAYER_DENSITY: 3.68,
PLAYER_DENSITY: 12.2, //3.68,
PLAYER_FRICTION: 5,
PLAYER_MOTION_FRICTION: 0.1,
PLAYER_RESTITUTION: 0.0,

View file

@ -278,7 +278,10 @@ function (Parent, Box2D, Settings, CollisionDetector, Item, Nc) {
if (this.isStanding()) {
this.body.SetAwake(true);
var vector = new Box2D.Common.Math.b2Vec2(0, -Settings.JUMP_SPEED);
var jumpSpeed = Settings.JUMP_SPEED;
var vector = new Box2D.Common.Math.b2Vec2(0, -jumpSpeed);
this.body.SetLinearVelocity(vector);
this.setStanding(false);

View file

@ -72,10 +72,7 @@ function (Parent, Box2D, Options, Settings, Exception, Nc) {
var fixtureDef = new Box2D.Dynamics.b2FixtureDef();
fixtureDef.shape = itemShape;
var offset = 4,
factor = 80;
var density = ((this.options.weight + offset) / this.options.width / this.options.height) * factor;
fixtureDef.density = density;
fixtureDef.density = this.options.weight;
fixtureDef.friction = Settings.ITEM_FRICTION;
fixtureDef.restitution = this.options.bounce