CMSC 110 (Introduction to Computing)

Fall 2016

Assignment #5

Due by 1:10pm on Monday, November 21, 2016 (RE) / 12:55pm on Tuesday, November 22, 2016 (DK)

Task: Using object-oriented design, write an interactive program featuring an animation. You must include some mechanism for adding more animations to the sketch. Your sketch must also take some action when the user clicks on an existing animation. (Harder alternative: your sketch can take an action when two animations collide.) Use a class to represent your animation, and you will need to use an array to model each animated piece. Here are some ideas to get your creative juices flowing:

Requirements, as seen by a user:

  1. Some animated feature that can appear in any part of the sketch.
  2. A mechanism for the user (or just time) to introduce an unbounded number of these animated features (that is, the user can create as many as they want, or time will eventually create as many as a patient user wants).
  3. All the animations need to be animated concurrently (that is, you cannot have just one part be animated at a time).
  4. An interactive action that takes place when the user clicks on an animated feature. (If your animated feature is not rectangular, this can be hard. It is OK if you pretend that your feature is a rectangle or other convenient approximation for the purposes of detecting whether or not it has been clicked on.)
  5. Harder alternative, replacing the requirement just above: When two of your animated features collide, an interactive action takes place. Similar to the above requirement, you can approximate the shape of your feature to simplify the math. (Circles are easier than rectangles for this one!)

Requirements in your code:

  1. Your animated feature must be encapsulated into a class.
  2. The class should be designed so that all the animation logic is in the class; your code outside the class should be rather simple.
  3. You must use an array to store your class objects.
  4. Detection of clicking on a feature or collision between features must use an if inside of a for.

Hint: The expand() and append() functions are your friends for adding onto an array.

Hint: We ask you to hand in an image of your sketch. You can create a screen shot or use the keyPressed() function (look it up in the reference!) to make a call to save().

What to Hand in: Hand in the entire sketch folder in your Dropbox folder. Make sure to include:

  1. Your sketch code (the .pde file)
  2. A gif/jpg/png image of your finished sketch
  3. A write-up with your name, course and assignment number and a paragraph about the sketch, its inspiration, and how you designed and implemented it. Include a brief discussion about your experience working on this assignment.
Hand in a printout of all three class on the due date.