public void changeDir(boolean MovingX, boolean MovingY){
			if(MovingX){
				if(!collision(x, y, 0, -1)) dir = 3;
				if(!collision(x, y, 0, 1 )) dir = 1;
			}
			
			if(MovingY){
				if(!collision(x, y, 1,  0)) dir = 0;
				if(!collision(x, y, -1, 0)) dir = 2;
			}
	}