Skip to content

Commit

Permalink
[#560] fixed entity position when manually updating their position
Browse files Browse the repository at this point in the history
  • Loading branch information
obiot committed Aug 21, 2014
1 parent 3e17608 commit e40e351
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/platformer/js/entities/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ game.PlayerEntity = me.Entity.extend({
} else {
this.pos.sub(response.overlapV);
this.hurt();
this.updateBounds();
}
}
break;
Expand Down Expand Up @@ -215,9 +216,12 @@ game.PathEnemyEntity = me.Entity.extend({
this.startX = x;
this.endX = x + width - settings.spritewidth
this.pos.x = x + width - settings.spritewidth;
// update the entity bounds since we manually change the entity position
this.updateBounds();

// apply gravity setting if specified
this.body.gravity = settings.gravity || me.sys.gravity;

this.walkLeft = false;

// walking & jumping speed
Expand Down

0 comments on commit e40e351

Please sign in to comment.