Skip to content

Commit

Permalink
fixed #14, where char isnt forced to update to get armour
Browse files Browse the repository at this point in the history
  • Loading branch information
TimRepke committed Oct 17, 2015
1 parent 817e05e commit 4f08041
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions registration-system/view/signups/game1/js/character.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ Char.prototype.initializeAnimations = function() {
});
};
Char.directionToName = ["UP", "RIGHT", "DOWN", "LEFT"];
Char.prototype.animate = function() {
this.animateStep += 1;
if (this.animateStep <= 8) return;
while (this.animateStep > 8)
this.animateStep -= 8;

Char.prototype.animate = function(force) {
if(force) {
this.animateStep = 0;
} else {
this.animateStep += 1;
if (this.animateStep <= 8) return;
while (this.animateStep > 8)
this.animateStep -= 8;
}
var xSpeed = this.translation[0] - this.lastPosition[0];
var ySpeed = - this.translation[1] + this.lastPosition[1];
this.lastPosition = this.translation.slice();
Expand All @@ -91,7 +94,7 @@ Char.prototype.animate = function() {
lastFrame.style.display = 'none';
}
// change animation
if (direction != this.lastDirection) {
if (direction != this.lastDirection || force) {
this.lastDirection = direction;
this.currentFrame = 0;
this.frames = this.animations[Char.directionToName[direction]+postfix];
Expand Down
2 changes: 1 addition & 1 deletion registration-system/view/signups/game1/js/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Story.actions = {
condition: Environment.progress.inventory_money,
action: function () {
Environment.progress.inventory_ruestung = true;
if (Game.char) Game.char.animate(); // apply new visuals
if (Game.char) Game.char.animate(true); // apply new visuals
}
}, {
message: 'Was? Spende? Ich hab\' nichts!',
Expand Down
2 changes: 1 addition & 1 deletion registration-system/view/signups/game1/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

#game-overlay.loading {
background: #000 url('graphics/loader.svg') no-repeat 300px 200px !important;
background: #000 url('graphics/loader.gif') no-repeat 300px 200px !important;
display: block !important;
}

Expand Down

0 comments on commit 4f08041

Please sign in to comment.