what I am trying to do is find where on my picture of a board game a person clicked and change the value according to it in my 2d array. It's kind of like tic tac toe but bigger and you place the stones on the intersections. So far I was able to get my x and y position of my mouse and check if the user clicked the first top left hand intersection and that works but I was thinking of writing some sort of for loop that will check all of the intersection points.
This is my code for checking the top intersection
if ((x >= 278 && x <= 285) && ( y >= 160 && y <= 175))
{
System.out.println("intersection 1 clicked");
}
So my question is how would I write my for loop to check all of the intersections? Even the logic is just fine if you don't feel like writing code.
Thanks in advance any help is much appreciated.
https://i.stack.imgur.com/yzPTA.png this is my program running the top left hand stone is my cursor
https://i.stack.imgur.com/l6UrW.png and this is my code