public void setDirection(Direction dir)
{
if (dir.Equals(Direction.Undefined)) return;
//we should have a standard convention for spritesheets
//i.e. each row is a direction
if (this.getImageRows() >= 4)
{
switch (dir)
{
case Direction.NorthEast:
case Direction.NorthWest:
case Direction.North: this.setFrameRow(3);
this.direction = Direction.North; break;
case Direction.SouthEast:
case Direction.SouthWest:
case Direction.South: this.setFrameRow(0);
this.direction = Direction.South; break;
case Direction.East: this.setFrameRow(2);
this.direction = Direction.East; break;
case Direction.West: this.setFrameRow(1);
this.direction = Direction.West; break;
default: break;
}
}
}