Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.

  1. Write an animated gopher-type game in which the program displays a circle at a random location on the screen, waits for a while and then moves the circle to another location. If the user clicks on the circle, give them a point, otherwise, give them no points. Display the user’s score at all times. See an example on the right.

    Note that because of the way Processing handles the draw() and mouseClicked() methods, you cannot easily implement the waiting behavior by setting a slower frame rate. Processing will call draw() first, thus moving the target before it calls mouseClicked().

    Extra Credit: As an extra credit exercise, you can change the target to a more sophisticated composite figure of some sort. You’ll need to modify your point system to determine when the user has clicked on any part of your new figure shape.

  2. Write an image choosing application similar to the one shown on the right. The system presents the four images on the left and allows the user to select the one that should be displayed on the right.

  3. Write a simple game called MoveToTarget that attempts to move a figure to a target using keys. Your solution should satisfy the following:

    1. Use the keys 'a' for left, 'w' for up, 's' for down, and 'd' for right
    2. The figure should begin in the center of the screen
    3. The target should be in a random location on the screen
    4. If the figure touches the target, the words "You Win!" should appear in the top corner of the screen and the animation should cease.
    Extra Credit: This assignment has lots of room for extensions, which are encouraged. For example:
    1. Instead of using circles for the target and figure, use a more elaborate composite figure for each.
    2. Add an obstacle that appears randomly on the screen. If the figure is touched by the obstacle, print "You Lose!" on the screen and stop the animation.
    3. Add a maze component that limits the directions that the figure can move.
    Feel free to add as many extensions as you'd like, but there is a maximum 10% extra credit.
     

Checking In

Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria:

If you work in teams for this homework assignment, be sure to submit all team members’ names in the code documentation.