Adds forward walking on shift

The state of the shift modifier is now distributed across the
network. Walking speeds and animation states are being updated
according to it.

Fixes #130
This commit is contained in:
logsol 2016-10-09 19:56:06 +02:00
parent 062402db58
commit b798e6acac
5 changed files with 39 additions and 9 deletions

View file

@ -228,14 +228,14 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
}
};
Doll.prototype.move = function (direction) {
Doll.prototype.move = function (direction, modifierActivated) {
this.moveDirection = direction;
var speed;
var isHoldingHeavyItem = this.holdingItem && this.holdingItem.options.weight > Settings.MAX_RUNNING_WEIGHT;
switch(true) {
case direction == this.lookDirection && this.isStanding() && !isHoldingHeavyItem:
case direction == this.lookDirection && this.isStanding() && !isHoldingHeavyItem && !modifierActivated:
speed = Settings.RUN_SPEED;
break;
@ -264,7 +264,7 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
if(this.isStanding()) {
if(this.moveDirection == this.lookDirection) {
if(isHoldingHeavyItem) {
if(isHoldingHeavyItem || modifierActivated) {
this.setActionState("walk");
} else {
this.setActionState("run");