CS110 (Introduction to Computing)

Fall 2012 - Section 2

Assignment #3

Due by 4:00 pm on Thursday, October 4, 2012

Task: Design two objects -- whatever you feel like drawing. For each object, write a function of the following form to draw it:


    def drawMyObject(x, y, w, h):
        ...

... where the x and y arguments are the object's location on the sketch, and the w and h arguments are the object's approximate width and height.

Insert the name of each of your objects in place of "MyObject" in your function names. Because you are drawing two objects, this will result in two functions with names like drawMyObject1() and drawMyObject2().

Write a program that draws several versions (at least 3) of each object in a sketch that is at least 500 x 500 pixels in size. Use the random() function to generate x, y, w and h values to pass to each function, so that the sketch changes each time it is run. You can also vary the coloring of the object, or any other property each time it is drawn.

At least one of your objects must interact with the mouse in two manners:

  1.  Based on the position of the mouse.  You can design this interactivity however you like, but here are some ideas to get you started:
  1. Based on when the mouse is over the object.  Again, you can design this however you like, but here are some ideas:

While you may have an object that follows the mouse (i.e., is drawn at a location based on mouseX() and mouseY()), you cannot count this toward either of the two interactive components.

Pay special attention to the aesthetic aspects of your design as well as interactivity.  Your sketch should be creative!!

Hints:

Requirements:

Carefully read the Assignment Submission Policy for how to submit your assignment.