Simple Maze Game Problem

err…

You don’t have reached a full understanding of the idea…

1.

This line
color colorFromMousePosition = get(mouseX, mouseY);
would not be executed throughout but only once at start.
It’s not a rule / standing order that processing would execute throughout or so.

Instead you need to repeat colorFromMousePosition = get(mouseX, mouseY); in a part that gets executed again and again - so in the display() method of the class for example, or in boundary().

void boundary () {
   colorFromMousePosition = get(mouseX, mouseY);  //   !!!!! 

   if (brightness(colorFromMousePosition) == 255) {
      ellipse (mouseX, mouseY, 12, 12);
      ....

2.

Of course you don’t want to test your point of the maze with mouseX,mouseY, that was only an example.
You want to test it with the ball position — or is the mouse position the ball position?
Then my point (2) is irrelevant.

I don’t understand fully, if you want to drag the ball with the mouse? Probably the dragging should only be allowed when there’s no wall in the way?

Chrisir

1 Like