CS 120A   Fall 2001,  Instructor:  Jeffrey Horn
 

HOMEWORK 4:  "Catch That Thief!"

  1. More sophisticated array manipulation (delete from middle, insert in middle, etc.)
  2. More buttons  (Make an array of them!)
  3. Use of boolean state variables to keep track of what STATE the world is in.
  4. Some animation.
  5. Dialog boxes for text input from user.
Assignment:
  1. You are free to start from scratch, or use your classes from previous HWs, or use our Forrest World code, etc.
  2. As in HW3, 
    • Write your own class like Tree, that paints a nice re-locatable graphic and dynamically adjustable size (i.e., it can grow!)  (call this the HOUSE)
    • Create an array of objects of your class, and use this to store the varying number of objects of your class that will be created (and deleted) during runtime.
    • Write another class of some smaller, also re-locatable, object.  (the THIEF)
  3. Now here are the basics of the game you must implement:
    • Game starts with a certain number, say 10, of your objects randomly located in the world (they can have random sizes too if you like).
    • A single THIEF is then seen (animate) moving into one of the houses from the side of the screen. 
    • The user now has to click on the house with the thief.  Once the user does so, the score is increased.  Display the score in the window, at all times.
    • The user can also drag a house.  If they drag it outside of the boundaries, it is deleted, BUT then the game gets harder (the houses all grow larger and TWO new houses are added at random).
    • Every X number of mouse clicks, the thief moves to another house, at random.  Animate this.
    • Have buttons for RESET, 
    • Have dialog boxes to allow the user to input the number of thieves, the starting number of houses, the rate at which they grow, the rate at which new ones are added, X (the number of mouse clicks between movements of the thief)
  4. Put your name, date, the class, and the assignment number in comments at the TOP of your source code.

  5. Comment EVERY single new variable AND method that you create.   For this assignment, I WILL start being picky about the CONTENT of your comments.  So be brief, but descriptive!  

  6. Turn in via WebCT.

  7. Grading rubric:

  • <=C for successful array manipulation (insert, delete from middle, reset)
  •  <=B  for working buttons (i.e., mousePressed working with an array of buttons)
  • <= A- for correct use of state variables (whether boolean or int or whatever).
  •  <= A for working animation (flicker is OK) and dragging ability.
  • Comment all of your methods and classes!  (keep 'em short and simple)
  • dialog boxes and flicker-free animation are extra credit!