float dirModule(int dir){
		float d=0;
		switch(dir){
		case 0:
			d=-x+2*y;
			break;
		case 1:
			d=x;
			break;
		case 2:
			d=x+y;
			break;
		case 3:
			d=-x-2*y;
			break;
		case 4:
			d=-x+y;
			break;
		case 5:
			d=-x-y;
			break;
		case 6:
			d=-x+y;
			break;
		case 7:
			d=-x-y;
			break;
		}
		return d;
	}