This is a lot of code in one main loop, I would suggest splitting the functionality into more functions.
To answer your question; the reason your console is spamming “It Worked!”. Is because your “if” statement is inside a continuous while-loop. You could try adding an extra boolean to your if statement, as such:
//GAMEPLAY
boolean hasMoved = false;
while (true)
{
//2,0
if (xCord == 2 && yCord == 0 && !hasMoved)
{
Console.WriteLine("It worked.");
hasMoved = true;
}
else{
hasMoved = false;
}
CLICK HERE to find out more related problems solutions.