Create an Operation Game style avoidance game

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.

Tagged:

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.

  • if(green(get(mouseX, mouseY))==255){ mouseX =10; mouseY =10; }

  • 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.

Sign In or Register to comment.