mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
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:
parent
062402db58
commit
b798e6acac
5 changed files with 39 additions and 9 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue