import java.awt.Image;

public class Platform extends Obj implements java.io.Serializable {
	static final long serialVersionUID = 1L;
	public int type;

	protected Image[] images;

	public static enum Direction {BACK, THISSIDE, RIGHT, LEFT};
	public static final int PLATFORM_BACK = 0;
	public static final int PLATFORM_THISSIDE = 1;
	public static final int PLATFORM_RIGHT = 2;
	public static final int PLATFORM_LEFT = 3;
	protected Direction direction;
	protected static int size;
	
	public Image getImage(){
		return images[0];
	}
	
	public int getSize() {
		return size;
	}
	
	public static int getSizeS() {
		return size;
	}

	public Direction getDirection() {
		return direction;
	}
	
	public int checkOnObj( Obj o ) {
		int objX = o.getX();
		int objY = o.getY();
		int objZ = o.getZ();
		int platformSize = getSize()/2;
		int platformX = getX();
		int platformY = getY();
		int platformZ = getZ();
		int offsetX = (Body.MAXSIZE - getSize())*7/32-28;
		int offsetY = (Body.MAXSIZE - getSize())*6/16-40;
			if ( objZ == 0 ){	//空中の物は移動させない
				if ((platformX + offsetX)<=(objX) && (objX)<=(platformX + offsetX + platformSize)){	//X軸比較
					if ((platformY + offsetY)<=(objY) && (objY)<=(platformY + offsetY + platformSize)){	//Y軸比較
						run( o );
						return 1;
					}
				}
			}
		return 0;
	}

	public int run( Obj o ) {
		return 0;
	}
	
	public Platform(int initX, int initY, Direction initDir) {
		objType = Type.PLATFORM;
		x = initX;
		y = initY;
		z = 0;
		direction = initDir;
	}
}