* @param sprite
* @return
*/
public Image getSprite(Direction dir, boolean isMoving, boolean isLeftFoot,
int sprite) {
SpriteSheet sheet = spriteSheets.get(sprite);
if (isMoving) {
if (isLeftFoot) {
switch (dir) {
case Up:
return sheet.getSprite(0, 0);
case Down:
return sheet.getSprite(0, 2);
case Left:
return sheet.getSprite(0, 3);
case Right:
return sheet.getSprite(0, 1);
}
} else {
switch (dir) {
case Up:
return sheet.getSprite(2, 0);
case Down:
return sheet.getSprite(2, 2);
case Left:
return sheet.getSprite(2, 3);
case Right:
return sheet.getSprite(2, 1);
}
}
} else {
switch (dir) {
case Up:
return sheet.getSprite(1, 0);
case Down:
return sheet.getSprite(1, 2);
case Left:
return sheet.getSprite(1, 3);
case Right:
return sheet.getSprite(1, 1);
}
}
return null;
}