I am making a maze game and I am trying to implement a wall feature that will restrict the movement of a player if he collides with a wall. I have created a wall class so that I can implement multiple walls manually. The problem is my intersectsWith method which detects if a circle and a rectangle are colliding(player is a circle) takes in a player of type Player and a single wall of type Wall. How would I make it so that my method can detect collision to all the walls in the game and not just one so that if my player encounters any wall it would detect it? I feel like I need to use an ArrayList of walls or something like that.
I actually just made a game engine, so I've worked with collisions quite a bit.
for (Wall w : wallsArrayList) {
if (myRectangle.intersects(w)) {
return true;
}
}