CSE143 Winter 2003

Project 4A

Floaters

Due date details Overview  

Back to Project 3 instructions

Starting code

Timer class code

Written part Rules, advice, guidelines

Hints, tips, and corrections Please check here occasionally!

  Turn-in forms

 

Due dates: Electronic parts are due on Wednesday evening, Feb. 19.  Paperwork and written parts due in class on Thursday, Feb. 20.

Overview

Unanswered from Project 3 was this: what to do when the screen filled with characters?  In Project 4A, you will again generate characters randomly when the mouse is clicked.  The difference is that this time, each new character appears at the spot where the mouse was clicked; and after appearing, the characters slowly drift about the screen.  The drifting must appear smooth, must remain on the screen (not drift off), and not stop moving.   Otherwise there are no restrictions of the pattern of drift.   In particular, there is no requirement to avoid collisions or overlaps.  (Part B, for which instructions will be provided later, will turn the activity into a sort of game, with the ability to push the floaters around and for floaters to join together.)

There is no written part, except for a screen snapshot (see below).    The requirements of Project 3 remain in effect, except as noted specifically below, or except to achieve the new program behavior.

Starting Code

The effect of animation is produced by redrawing the picture frequently, with the objects moved slightly each time.  In order to do this in a program, you must 1) keep track of the position of the objects, and update the position each time the picture is drawn and 2) have a way for the drawing method(s) to be called on a frequent, regular basis.  The other main new programming idea in the project is 3) to know where the mouse click happened.

1) Use your solution to Project 3 as a basis (or the sample solution that will be posted).

2) Code for a timer class is given.  Comments in the code explain how to use it.  It works like a ticking clock.  At every tick, the timer calls a method which causes the screen to be repainted.

3) The mouse listener class from Project 3 can be adapted to find out the location of the click.  The information is contained within the MouseEvent object passed to the actionPerformed mouseClicked method (check the Sun Javadoc).

Additional requirements

RandCharDriver.java and RandCharController.java are still required, as before.  Names of other classes are optional.  You may define other classes and .java files as necessary.

Written part

  1. Once your solution is running with a small number of characters on the screen, take a screen snapshot.  Then add a couple of more characters, and take another snapshot.  Print the snapshots to hand in.  Pick two characters that appear on the first snapshot and circle them.  Circle the same two characters on the other snapshot, to show that they have moved.

Some rules (for this project):

Except as noted, the rules and requirements are the same as for Project 3.

Some advice:

The starter code for Project 3 had a bunch of code that you could safely ignore.  Don't ignore it any more.  Try to understand it.

Please read the turn-in forms carefully when they become available, including the fine print!  After submitting a form, read what comes back, too. Please make sure that you use the correct form for each part! Turnin form  

Buona Fortuna!

Hints, Tips, and Corrections

Starting the Floater Timer -- please read! 

Note: you may define additional classes and .java files as necessary.