package studio.junk.jam.coloritum.utils;

/**
 * Holding information about the direction in which the player is moving
 * 
 * @author marvin
 */
public class Direction {
	/**
	 * Possible directions on x axis
	 * 
	 * @author marvin
	 */
	public static enum X {
		none(0), left(-1), right(1);

		public final int sign;

		private X(int sign) {
			this.sign = sign;
		}
	}

	/**
	 * Possible directions on y axis
	 * 
	 * @author marvin
	 */
	public static enum Y {
		none(0), up(1), down(-1);

		public final int sign;

		private Y(int sign) {
			this.sign = sign;
		}
	}

	protected X	x;
	protected Y	y;

	/**
	 * Creates a new direction with an x and y coordinate
	 * 
	 * @param x
	 *            direction on x axis
	 * @param y
	 *            direction on y axis
	 */
	public Direction(X x, Y y) {
		set(x, y);
	}

	/**
	 * Sets this direction's components
	 * 
	 * @param x
	 *            direction on x axis
	 * @param y
	 *            direction on y axis
	 */
	public void set(X x, Y y) {
		this.x = x;
		this.y = y;
	}

	/**
	 * Returns the x component of this direction
	 * 
	 * @return x component of this direction
	 */
	public X getX() {
		return x;
	}

	/**
	 * Returns the y component of this direction
	 * 
	 * @return y component of this direction
	 */
	public Y getY() {
		return y;
	}
}
