Some Bloating Circles (download) Problems

Run the Bloating Circles program to make sure it works.

  1. Make sure the latest version of Processing is on your computer. You can download it here.
  2. Fix the Circle class so the fields and parameters adhere to proper coding covention.
  3. Modify one line of code to change the number of bloating circles to 20. (Using constants is an important concept.)
  4. Change the thickness of the circles to 5. (Think about how annoying this is when you can't find a constant.)
  5. Make Gunn bloating circles by having alternating red and black circles instead of random colors.
  6. Make it so the center of the circles goes to wherever you click:
    1. Create two new variables xClicked and yClicked and put them with the other global variables at the start of the whole program.
    2. Create a new tab called "Mouse Events" (without the quotes).
    3. The method mousePressed() is a special method in Processing (like the setup() and draw() methods). Write a mousePressed() method that captures the mouseX and mouseY of a mouse click and stores them in your new xClicked and yClicked variables.
    4. Modify your program so it draws circles from where the mouse was clicked rather than the center of the whole display.
  7. Make a separate project that does bloating squares.

Some notes...

  1. Processing has global variables. These are similar to public static variables in Scheme.
  2. When Processing starts, it goes through three methods in this order:
    1. settings(), which runs before the sketch is set up; settings() is not used in this program;
    2. setup(), which can call Processing commands (i.e., the stuff in the Processing API reference);
    3. draw(), which behaves as if it is in an infinite loop.
  3. Unlike Eclipse, Processing doesn't have a fancy editor. It catches compiler errors to some extent, but it can be hard to find the problems as the offending code is often not what gets underlined.
  4. If, when you compile your code, you are taken to a line that does not seem to have any errors, it probably doesn't! The most likely issue is a syntax error in a previous tab. While the tabs separate code, which is good for organizing things, Processing treats the code as one, long file. Often, a missing curly brace or an extra curly brace is the culprit.