We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I created a maze in Photoshop with two colors. Maze color (255, 0, 0) and Background color (0, 255, 00). I want to use the get() function to create a sketch where the mouse can only touch the maze color and if it touches the background color the sketch starts over.
Answers
Colorblind people hate you.
So anyway, what's the problem? Does it work?
Well actually I'm not sure where to begin. I was looking for some guidance. Anything is welcome and if you can't help that's also ok. I have an if() statement making mouseX and mouseY go back to the beginning of the path, but the cursor is not going with it.
if(green(get(mouseX, mouseY))==255){ mouseX =10; mouseY =10; }
The coordinates 10, 10 are just the beginning of the maze.
That's because mouseX and mouseY are read-only variables. All they do is record the current mouse position; the mouse itself is controlled by the OS and Processing has no access to that.
I'd recommend defining a MazeCursor class or something, which updates its position when dragged with the mouse, and resetting that instead.
There's also java Robot class which simulates input and may be used to set mouse position on the screen.