Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
Fixed animation for padded sprites, now the coordinates are calculate…
Browse files Browse the repository at this point in the history
…d correctly using own's element padding.
  • Loading branch information
NyanLeek committed Mar 24, 2012
1 parent 0f92305 commit 3955143
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ Crafty.c("SpriteAnimation", {
// .animate('PlayerRunning', 0, 0, 3) //setup animation
if (typeof fromx === "number") {
// Defind in Sprite component.
tile = this.__tile;
tileh = this.__tileh;
tile = this.__tile + parseInt(this.__padding[0] || 0, 10);
tileh = this.__tileh + parseInt(this.__padding[1] || 0, 10);

reel = [];
i = fromx;
Expand All @@ -127,8 +127,8 @@ Crafty.c("SpriteAnimation", {
i = 0;
reel = [];
tox = fromx.length - 1;
tile = this.__tile;
tileh = this.__tileh;
tile = this.__tile + parseInt(this.__padding[0] || 0, 10);
tileh = this.__tileh + parseInt(this.__padding[1] || 0, 10);

for (; i <= tox; i++) {
pos = fromx[i];
Expand Down

0 comments on commit 3955143

Please sign in to comment.