Hey everyone!

So i'm currently working on a little project where i have an array of 5 barriers, and one player object. The aim of it is that when you run the program, the player object will move to the closest barrier. When it reaches it, it disappears by setting the colour to (0.1, 0.1, 0.1). It is then supposed to move to the next nearest barrier not including the one that just disappeared and make that one disappear. It keeps doing this until all 5 barriers have disappears. There are many classes so i'll just paste the current code that i'm working on to see if anyone can understand where i'm going wrong (you wont be able to run it). I'm a beginner so I understand the code is probably horrible and messy but any advice would be greatly appreciated :)

I'm trying to set boolean values to determine what has been eaten but i can't get it to move past the first barrier. (it moves to the first closest one successfully and makes it disappear but it then stops at that barrier). Included image is what it looks like so you understand. The player object (the one that moves) is the white one.

Attachment 4125

Java Code:
	        float b1X = barriers[0].getX();
			float b1Y = barriers[0].getY();
			float b2X = barriers[1].getX();
			float b2Y = barriers[1].getY();
			float b3X = barriers[2].getX();
			float b3Y = barriers[2].getY();
			float b4X = barriers[3].getX();
			float b4Y = barriers[3].getY();
			float b5X = barriers[4].getX();
			float b5Y = barriers[4].getY();

			float poX = playerObject.getX();
			float poY = playerObject.getY();


			double[] poDist;
			poDist = new double[5];
			boolean[] booleanValue;
			booleanValue = new boolean[5];

			poDist[0] = Math.sqrt(((poX - b1X) * (poX - b1X))
					+ ((poY - b1Y) * (poY - b1Y)));

			poDist[1] = Math.sqrt(((poX - b2X) * (poX - b2X))
					+ ((poY - b2Y) * (poY - b2Y)));

			poDist[2] = Math.sqrt(((poX - b3X) * (poX - b3X))
					+ ((poY - b3Y) * (poY - b3Y)));

			poDist[3] = Math.sqrt(((poX - b4X) * (poX - b4X))
					+ ((poY - b4Y) * (poY - b4Y)));

			poDist[4] = Math.sqrt(((poX - b5X) * (poX - b5X))
					+ ((poY - b5Y) * (poY - b5Y)));

			double min = poDist[0];
			booleanValue[0] = false;
			booleanValue[1] = false;
			booleanValue[2] = false;
			booleanValue[3] = false;
			booleanValue[4] = false;

			for (int i = 0; i < poDist.length; i++) {
				if (poDist[i] < min) {
					min = poDist[i];
				}
			}

				int distance = (int) min;

				if (min == poDist[0]) {

					if (poX < b1X && !(poX > b1X)) {
						playerObject.setX(playerObject.getX() + 0.20 * delta);
					}
					if (poY < b1Y && !(poY > b1Y)) {
						playerObject.setY(playerObject.getY() + 0.20 * delta);
					}
					if (poX > b1X && !(poX < b1X)) {
						playerObject.setX(playerObject.getX() - 0.20 * delta);
					}
					if (poY > b1Y && !(poY < b1Y)) {
						playerObject.setY(playerObject.getY() - 0.20 * delta);
					}

					if (distance < (delta)) {
						barriers[0].setColour(0.1, 0.1, 0.1);
						booleanValue[0] = true;

					}

				}

				if (min == poDist[1]) {
					if (poX < b2X && !(poX > b2X)) {
						playerObject.setX(playerObject.getX() + 0.20 * delta);
					}
					if (poY < b2Y && !(poY > b2Y)) {
						playerObject.setY(playerObject.getY() + 0.20 * delta);
					}
					if (poX > b2X && !(poX < b2X)) {
						playerObject.setX(playerObject.getX() - 0.20 * delta);
					}
					if (poY > b2Y && !(poY < b2Y)) {
						playerObject.setY(playerObject.getY() - 0.20 * delta);
					}

					if (distance < (delta)) {
						barriers[1].setColour(0.1, 0.1, 0.1);
						booleanValue[1] = true;

					}

				}

				if (min == poDist[2]) {
					if (poX < b3X && !(poX > b3X)) {
						playerObject.setX(playerObject.getX() + 0.20 * delta);
					}
					if (poY < b3Y && !(poY > b3Y)) {
						playerObject.setY(playerObject.getY() + 0.20 * delta);
					}
					if (poX > b3X && !(poX < b3X)) {
						playerObject.setX(playerObject.getX() - 0.20 * delta);
					}
					if (poY > b3Y && !(poY < b3Y)) {
						playerObject.setY(playerObject.getY() - 0.20 * delta);
					}

					if (distance < (delta)) {
						barriers[2].setColour(0.1, 0.1, 0.1);
						booleanValue[2] = true;

					}

				}

				if (min == poDist[3]) {
					if (poX < b4X && !(poX > b4X)) {
						playerObject.setX(playerObject.getX() + 0.20 * delta);
					}
					if (poY < b4Y && !(poY > b4Y)) {
						playerObject.setY(playerObject.getY() + 0.20 * delta);
					}
					if (poX > b4X && !(poX < b4X)) {
						playerObject.setX(playerObject.getX() - 0.20 * delta);
					}
					if (poY > b4Y && !(poY < b4Y)) {
						playerObject.setY(playerObject.getY() - 0.20 * delta);
					}

					if (distance < (delta)) {
						barriers[3].setColour(0.1, 0.1, 0.1);
						booleanValue[3] = true;

					}

				}

				if (min == poDist[4]) {
					if (poX < b5X && !(poX > b5X)) {
						playerObject.setX(playerObject.getX() + 0.20 * delta);
					}
					if (poY < b5Y && !(poY > b5Y)) {
						playerObject.setY(playerObject.getY() + 0.20 * delta);
					}
					if (poX > b5X && !(poX < b5X)) {
						playerObject.setX(playerObject.getX() - 0.20 * delta);
					}
					if (poY > b5Y && !(poY < b5Y)) {
						playerObject.setY(playerObject.getY() - 0.20 * delta);
					}

					if (distance < (delta)) {
						barriers[4].setColour(0.1, 0.1, 0.1);
						booleanValue[4] = true;

					}

				}

			}
		}
	}