Fix player idle sprite to face last walked direction instead of always facing forward
This commit is contained in:
@@ -387,7 +387,7 @@ class Game {
|
|||||||
/* Show the idle/middle frame for the last direction walked
|
/* Show the idle/middle frame for the last direction walked
|
||||||
Frames at 2× scale (32px each): down=32, up=128, left=224, right=320 */
|
Frames at 2× scale (32px each): down=32, up=128, left=224, right=320 */
|
||||||
const idleFrames = { right:'-32px', down:'-32px', left:'-128px', up:'-224px' };
|
const idleFrames = { right:'-32px', down:'-32px', left:'-128px', up:'-224px' };
|
||||||
p.style.backgroundPositionX = idleFrames[this.state.pathDir] || '-32px';
|
p.style.backgroundPositionX = idleFrames[this.state.lastDir] || '-32px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user